mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-15 07:56:11 +08:00

Stop it being a singleton. This means it needs to be passed around a lot. This sucks, but it's how it should be. I shouldn't be using a global variable to get around this. This is needed as Settings will soon become repo specific when we support multiple repos. This breaks saving the settings in a file, that feature was toggled off anyway. It needs to be thought over again.
35 lines
1.0 KiB
Dart
35 lines
1.0 KiB
Dart
import 'dart:async';
|
|
import 'dart:isolate';
|
|
|
|
import 'package:flutter/foundation.dart' as foundation;
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import 'package:gitjournal/app.dart';
|
|
import 'package:gitjournal/app_settings.dart';
|
|
import 'package:gitjournal/error_reporting.dart';
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
var pref = await SharedPreferences.getInstance();
|
|
AppSettings.instance.load(pref);
|
|
|
|
JournalApp.isInDebugMode = foundation.kDebugMode;
|
|
FlutterError.onError = flutterOnErrorHandler;
|
|
|
|
Isolate.current.addErrorListener(RawReceivePort((dynamic pair) async {
|
|
var isolateError = pair as List<dynamic>;
|
|
assert(isolateError.length == 2);
|
|
assert(isolateError.first.runtimeType == Error);
|
|
assert(isolateError.last.runtimeType == StackTrace);
|
|
|
|
await reportError(isolateError.first, isolateError.last);
|
|
}).sendPort);
|
|
|
|
runZonedGuarded(() async {
|
|
await JournalApp.main(pref);
|
|
}, reportError);
|
|
}
|