Added raw-failure logs to flutter app (to debug init errors)
This commit is contained in:
@@ -2,7 +2,9 @@ import 'dart:io';
|
||||
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
class Globals {
|
||||
static final Globals _singleton = Globals._internal();
|
||||
@@ -26,6 +28,9 @@ class Globals {
|
||||
|
||||
late SharedPreferences sharedPrefs;
|
||||
|
||||
late Directory appDocumentsDir;
|
||||
late Directory rawFailureLogsDir;
|
||||
|
||||
bool get isInitialized => _initialized;
|
||||
|
||||
Future<void> init() async {
|
||||
@@ -61,6 +66,11 @@ class Globals {
|
||||
|
||||
this.sharedPrefs = await SharedPreferences.getInstance();
|
||||
|
||||
this.appDocumentsDir = await getApplicationDocumentsDirectory();
|
||||
|
||||
this.rawFailureLogsDir = Directory(path.join(Globals().appDocumentsDir.path, "rawlogs"));
|
||||
await this.rawFailureLogsDir.create(recursive: true);
|
||||
|
||||
this._initialized = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user