mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-08-24 17:31:06 +08:00

I'm not planning a macos version, but it's super useful to be able to run the desktop version for testing, as it doesn't need me to run things on an emulator or physical device.
46 lines
1.3 KiB
Dart
46 lines
1.3 KiB
Dart
/*
|
|
* SPDX-FileCopyrightText: 2019-2021 Vishesh Handa <me@vhanda.in>
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
import 'dart:async';
|
|
import 'dart:io';
|
|
import 'dart:isolate';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
|
import 'package:gitjournal/app.dart';
|
|
import 'package:gitjournal/error_reporting.dart';
|
|
import 'package:gitjournal/settings/app_config.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:stack_trace/stack_trace.dart';
|
|
|
|
Future<void> main() async {
|
|
var _ = WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
var pref = await SharedPreferences.getInstance();
|
|
AppConfig.instance.load(pref);
|
|
|
|
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);
|
|
|
|
if (Platform.isIOS || Platform.isAndroid) {
|
|
await FlutterDisplayMode.setHighRefreshRate();
|
|
}
|
|
|
|
await runZonedGuarded(() async {
|
|
await Chain.capture(() async {
|
|
await JournalApp.main(pref);
|
|
});
|
|
}, reportError);
|
|
}
|