You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using allReady in one of my widgets. One of the services I've registered fails to complete in the timeout (which isn't the fault of this package), so the function errors out.
The following _TypeError was thrown building MyApp(dirty):
Null check operator used on a null value
When the exception was thrown, this was the stack:
#0 _WatchItState.allReady (package:watch_it/src/watch_it_state.dart:513:11)
#1 allReady (package:watch_it/src/watch_it.dart:430:8)
...
Looking at the source for that file:
returnregisterFutureHandler<Object, bool>(
handler: (context, x, dispose) {
if (x.hasError) {
onError?.call(context, x.error);
} else {
onReady?.call(context);
if (shouldRebuild) {
(context asElement).markNeedsBuild();
}
}
dispose();
},
allowMultipleSubscribers:false,
initialValueProvider: () =>GetIt.I.allReadySync(),
/// as `GetIt.allReady` returns a Future<void> we convert it /// to a bool because if this Future completes the meaning is true.
futureProvider: () =>GetIt.I.allReady(timeout: timeout).then((_) =>true),
).data!;
In particular, it's the data! null check operator which is throwing the exception. Am I using the allReady incorrectly or should there be some additional null checking in the allReady function?
Thank you.
The text was updated successfully, but these errors were encountered:
Fixed in 1.1.0 allready() now throw a correct time out exception and unless you provide an error handler it will also throw if you factory functions throw any other error.
I'm using
allReady
in one of my widgets. One of the services I've registered fails to complete in the timeout (which isn't the fault of this package), so the function errors out.When I run this, I correctly see the error printed out. You could reproduce this with a particular service (using
injectable
):When I hot refresh, I get the error:
Looking at the source for that file:
In particular, it's the
data!
null check operator which is throwing the exception. Am I using theallReady
incorrectly or should there be some additional null checking in theallReady
function?Thank you.
The text was updated successfully, but these errors were encountered: