-
Notifications
You must be signed in to change notification settings - Fork 178
Expand file tree
/
Copy pathmain.dart
More file actions
58 lines (51 loc) · 1.8 KB
/
main.dart
File metadata and controls
58 lines (51 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import 'dart:ffi';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:taskwarrior/app/services/deep_link_service.dart';
import 'package:taskwarrior/app/utils/app_settings/app_settings.dart';
import 'package:taskwarrior/app/utils/debug_logger/log_databse_helper.dart';
import 'package:taskwarrior/app/utils/themes/dark_theme.dart';
import 'package:taskwarrior/app/utils/themes/light_theme.dart';
import 'package:taskwarrior/rust_bridge/frb_generated.dart';
import 'app/routes/app_pages.dart';
LogDatabaseHelper _logDatabaseHelper = LogDatabaseHelper();
DynamicLibrary loadNativeLibrary() {
if (Platform.isIOS) {
return DynamicLibrary.open('Frameworks/tc_helper.framework/tc_helper');
} else if (Platform.isAndroid) {
return DynamicLibrary.open('libtc_helper.so');
} else if (Platform.isMacOS) {
return DynamicLibrary.open('tc_helper.framework/tc_helper');
}
throw UnsupportedError(
'Platform ${Platform.operatingSystem} is not supported');
}
void main() async {
debugPrint = (String? message, {int? wrapWidth}) {
if (message != null) {
debugPrintSynchronously(message, wrapWidth: wrapWidth);
_logDatabaseHelper.insertLog(message);
}
};
loadNativeLibrary();
await RustLib.init();
WidgetsFlutterBinding.ensureInitialized();
await AppSettings.init();
await Get.putAsync<DeepLinkService>(() async {
final service = DeepLinkService();
await service.init();
return service;
}, permanent: true);
runApp(
GetMaterialApp(
darkTheme: darkTheme,
theme: lightTheme,
title: "Application",
initialRoute: AppPages.INITIAL,
getPages: AppPages.routes,
themeMode: AppSettings.isDarkMode ? ThemeMode.dark : ThemeMode.light,
),
);
}