2024-04-30 23:38:49 +08:00
|
|
|
import 'dart:async';
|
2024-07-15 22:06:09 +08:00
|
|
|
import 'dart:io';
|
2024-04-30 23:38:49 +08:00
|
|
|
|
2025-12-16 11:23:09 +08:00
|
|
|
import 'package:fl_clash/pages/error.dart';
|
2024-04-30 23:38:49 +08:00
|
|
|
import 'package:fl_clash/state.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
2025-02-09 18:39:38 +08:00
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
2024-12-03 21:47:12 +08:00
|
|
|
|
2024-04-30 23:38:49 +08:00
|
|
|
import 'application.dart';
|
2024-12-03 21:47:12 +08:00
|
|
|
import 'common/common.dart';
|
2024-04-30 23:38:49 +08:00
|
|
|
|
|
|
|
|
Future<void> main() async {
|
2025-12-16 11:23:09 +08:00
|
|
|
try {
|
|
|
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
|
final version = await system.version;
|
|
|
|
|
final container = await globalState.init(version);
|
|
|
|
|
HttpOverrides.global = FlClashHttpOverrides();
|
|
|
|
|
runApp(
|
|
|
|
|
UncontrolledProviderScope(
|
|
|
|
|
container: container,
|
|
|
|
|
child: const Application(),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
} catch (e, s) {
|
|
|
|
|
return runApp(
|
|
|
|
|
MaterialApp(
|
|
|
|
|
home: InitErrorScreen(error: e, stack: s),
|
|
|
|
|
),
|
|
|
|
|
);
|
2024-04-30 23:38:49 +08:00
|
|
|
}
|
|
|
|
|
}
|