17 lines
407 B
Dart
17 lines
407 B
Dart
import 'dart:async';
|
|
|
|
import 'log.dart';
|
|
|
|
abstract class Application {
|
|
late Function(Object, StackTrace) writeLog;
|
|
|
|
Application(Function() func, Function(Object, StackTrace) errorListener) {
|
|
runZonedGuarded(() async {
|
|
writeLog = (error, stack) => logError('$error:\n$stack');
|
|
func();
|
|
}, (error, stack) {
|
|
writeLog(error, stack);
|
|
errorListener(error, stack);
|
|
});
|
|
}
|
|
}
|