feat: support custom tracker url (#59)

This commit is contained in:
Li Wei authored and GitHub committed 2022-12-12 15:58:11 +08:00
1 parent 9ef3405e43
commit 691c2f496e
71 files changed
+2209 -891

No files matched your search

+10 -1
View File
@@ -1,5 +1,6 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:logger/logger.dart';
import 'package:logger/src/outputs/file_output.dart';
@@ -7,5 +8,13 @@ import 'util.dart';
final logger = Logger(
printer: PrettyPrinter(),
output: Util.isDesktop() ? FileOutput(file: File('log.txt')) : null,
output: buildOutput(),
);
buildOutput() {
// if is debug mode, output to console
if (!kDebugMode && Util.isDesktop()) {
return FileOutput(file: File('log.txt'));
}
return null;
}
+7
View File
@@ -0,0 +1,7 @@
import 'package:package_info_plus/package_info_plus.dart';
late PackageInfo packageInfo;
Future<void> initPackageInfo() async {
packageInfo = await PackageInfo.fromPlatform();
}
+22 -14
View File
@@ -3,6 +3,14 @@ import 'dart:io';
import 'package:flutter/foundation.dart';
class Util {
static String buildAbsPath(String dir, String path, String name) {
return (dir == "" ? "" : "$dir/") + buildPath(path, name);
}
static String buildPath(String path, String name) {
return (path == "" ? "" : "$path/") + name;
}
static String fmtByte(int byte) {
if (byte < 1024) {
return "$byte B";
@@ -15,24 +23,16 @@ class Util {
}
}
static String buildPath(String path, String name) {
return (path == "" ? "" : "$path/") + name;
}
static String buildAbsPath(String dir, String path, String name) {
return (dir == "" ? "" : "$dir/") + buildPath(path, name);
}
static isWeb() {
return kIsWeb;
}
static isAndroid() {
return !kIsWeb && Platform.isAndroid;
}
static isMacos() {
return !kIsWeb && Platform.isMacOS;
static isIOS() {
return !kIsWeb && Platform.isIOS;
}
static isMobile() {
return !kIsWeb && (Platform.isAndroid || Platform.isIOS);
}
static isDesktop() {
@@ -42,10 +42,18 @@ class Util {
return Platform.isWindows || Platform.isLinux || Platform.isMacOS;
}
static isMacos() {
return !kIsWeb && Platform.isMacOS;
}
static isUnix() {
if (kIsWeb) {
return false;
}
return !Platform.isWindows;
}
static isWeb() {
return kIsWeb;
}
}