Skip to content

Import database from bytes #3132

Discussion options

You must be logged in to vote

The reason you're getting this uncaught exception is because it happens in the insert in body_widget.dart, which is not awaited.

You can see the actual error when adapting the stream, for instance:

diff --git a/lib/widgets/todos_widget.dart b/lib/widgets/todos_widget.dart
index 13e17df..9106e66 100644
--- a/lib/widgets/todos_widget.dart
+++ b/lib/widgets/todos_widget.dart
@@ -19,6 +19,10 @@ class _TodosWidgetState extends State<TodosWidget> {
     return StreamBuilder(
         stream: db.todoItems.select().watch(),
         builder: (context, snapshot) {
+          if (snapshot.hasError) {
+            return Text(snapshot.error.toString());
+          }
+
           if (!snapshot.hasDat…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@simolus3
Comment options

Answer selected by AlexandreAndrade00
@AlexandreAndrade00
Comment options

Comment options

You must be logged in to vote
1 reply
@simolus3
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants