Skip to content

Commit

Permalink
fix(flutter_todos): zone mismatch error (#4225)
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasMirbt authored Aug 27, 2024
1 parent 0c68c96 commit 8cd56bc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions examples/flutter_todos/lib/bootstrap.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:async';
import 'dart:developer';

import 'package:bloc/bloc.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_todos/app/app.dart';
import 'package:flutter_todos/app/app_bloc_observer.dart';
Expand All @@ -13,12 +13,14 @@ void bootstrap({required TodosApi todosApi}) {
log(details.exceptionAsString(), stackTrace: details.stack);
};

PlatformDispatcher.instance.onError = (error, stack) {
log(error.toString(), stackTrace: stack);
return true;
};

Bloc.observer = const AppBlocObserver();

final todosRepository = TodosRepository(todosApi: todosApi);

runZonedGuarded(
() => runApp(App(todosRepository: todosRepository)),
(error, stackTrace) => log(error.toString(), stackTrace: stackTrace),
);
runApp(App(todosRepository: todosRepository));
}

0 comments on commit 8cd56bc

Please sign in to comment.