Fix Android issues

This commit is contained in:
2024-09-10 08:12:33 +09:00
parent a22c2ea730
commit 8ed6a4e8bf
17 changed files with 243 additions and 77 deletions

View File

@ -216,10 +216,7 @@ void main() async {
};
try {
await initServices();
runApp(const ProviderScope(child: MyApp()));
}catch(e, stackTrace){
print('Error during initialization: $e');
@ -244,19 +241,6 @@ Future<void> initServices() async {
Get.put(LocationController(), permanent: true);
debugPrint("2: Controllers initialized");
/*
// すべてのコントローラーとサービスを非同期で初期化
Get.lazyPut(() => IndexController(apiService: Get.find<ApiService>()));
debugPrint("2: start IndexController");
// その他のコントローラーを遅延初期化
Get.lazyPut(() => SettingsController());
debugPrint("2: start SettingsController");
Get.lazyPut(() => DestinationController());
debugPrint("3: start DestinationController");
Get.lazyPut(() => LocationController());
debugPrint("4: start LocationController");
*/
// 非同期処理を並列実行
await Future.wait([
@ -273,6 +257,7 @@ Future<void> initServices() async {
}catch(e){
print('Error initializing : $e');
rethrow;
}
print('All services started...');
@ -667,11 +652,14 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
}
void _checkMemoryUsage() async {
/*
final memoryInfo = await _getMemoryInfo();
//debugPrint('Current memory usage: ${memoryInfo['used']} MB');
if (memoryInfo['used']! > 100) { // 100MB以上使用している場合
_performMemoryCleanup();
}
*/
}
Future<Map<String, int>> _getMemoryInfo() async {