mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
chore: fix widget binding errors
This commit is contained in:
parent
de61d90938
commit
2822d5dbfd
@ -3,6 +3,7 @@ import 'dart:io';
|
|||||||
import 'dart:isolate';
|
import 'dart:isolate';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:logger/logger.dart';
|
import 'package:logger/logger.dart';
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
@ -16,11 +17,13 @@ class AppLogger {
|
|||||||
log = Logger(
|
log = Logger(
|
||||||
level: kDebugMode || (verbose && kReleaseMode) ? Level.all : Level.info,
|
level: kDebugMode || (verbose && kReleaseMode) ? Level.all : Level.info,
|
||||||
);
|
);
|
||||||
|
|
||||||
getLogsPath().then((value) => logFile = value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static R? runZoned<R>(R Function() body) {
|
static R? runZoned<R>(R Function() body) {
|
||||||
|
return runZonedGuarded<R>(
|
||||||
|
() {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
FlutterError.onError = (details) {
|
FlutterError.onError = (details) {
|
||||||
reportError(details.exception, details.stack ?? StackTrace.current);
|
reportError(details.exception, details.stack ?? StackTrace.current);
|
||||||
};
|
};
|
||||||
@ -42,8 +45,10 @@ class AppLogger {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return runZonedGuarded<R>(
|
getLogsPath().then((value) => logFile = value);
|
||||||
body,
|
|
||||||
|
return body();
|
||||||
|
},
|
||||||
(error, stackTrace) {
|
(error, stackTrace) {
|
||||||
reportError(error, stackTrace);
|
reportError(error, stackTrace);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user