1- import 'dart:ffi' ;
2- import 'dart:io' ;
31import 'package:flutter/foundation.dart' ;
42import 'package:flutter/material.dart' ;
53import 'package:get/get.dart' ;
@@ -9,41 +7,15 @@ import 'package:taskwarrior/app/utils/debug_logger/log_databse_helper.dart';
97import 'package:taskwarrior/app/utils/themes/dark_theme.dart' ;
108import 'package:taskwarrior/app/utils/themes/light_theme.dart' ;
119import 'package:taskwarrior/rust_bridge/frb_generated.dart' ;
12- import 'package:sqflite_common_ffi/sqflite_ffi.dart' ;
13- import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart' ;
10+ import 'package:taskwarrior/platform_bootstrap.dart' ;
1411
1512import 'app/routes/app_pages.dart' ;
1613
1714LogDatabaseHelper _logDatabaseHelper = LogDatabaseHelper ();
1815
19- DynamicLibrary loadNativeLibrary () {
20- if (kIsWeb) {
21- throw UnsupportedError ("Native libraries are not supported on Web" );
22- }
23-
24- if (Platform .isIOS) {
25- return DynamicLibrary .open ('Frameworks/tc_helper.framework/tc_helper' );
26- } else if (Platform .isAndroid) {
27- return DynamicLibrary .open ('libtc_helper.so' );
28- } else if (Platform .isMacOS) {
29- return DynamicLibrary .open ('tc_helper.framework/tc_helper' );
30- } else if (Platform .isLinux) {
31- return DynamicLibrary .open ('libtc_helper.so' );
32- } else if (Platform .isWindows) {
33- return DynamicLibrary .open ('tc_helper.dll' );
34- }
35- throw UnsupportedError (
36- 'Platform ${Platform .operatingSystem } is not supported' );
37- }
38-
3916void main () async {
40- // Initialize SQLite for Desktop platforms
41- if (! kIsWeb && (Platform .isLinux || Platform .isWindows || Platform .isMacOS)) {
42- sqfliteFfiInit ();
43- databaseFactory = databaseFactoryFfi;
44- }
45-
4617 WidgetsFlutterBinding .ensureInitialized ();
18+ initPlatform ();
4719
4820 // Redirect debug prints to the local database logger
4921 debugPrint = (String ? message, {int ? wrapWidth}) {
0 commit comments