i am doing screen change like this iam listing for stream and when it emit i change the screen
@override
void initState() {
super.initState();
appBloc.error.listen((data) {
_scaffoldKey.currentState.showSnackBar(new SnackBar(content: new
Text(data)));
});
appBloc.success.listen((_) => goToDashBoardScreen(context));
}
and doToDashBoardScreen look like this
Navigator.pushReplacement(context, new SlideRightRoute(widget:
DashBoardScreen()));
but i am getting error like this but i change the page.
22:05:02.446 3 info flutter.tools E/flutter (13216): NoSuchMethodError:
The method 'ancestorStateOfType' was called on null.
22:05:02.446 4 info flutter.tools E/flutter (13216): Receiver: null
22:05:02.446 5 info flutter.tools E/flutter (13216): Tried calling:
ancestorStateOfType(Instance of 'TypeMatcher<NavigatorState>')
22:05:02.446 6 info flutter.tools E/flutter (13216): #0
Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:48:5)
22:05:02.446 7 info flutter.tools E/flutter (13216): #1
Navigator.of (package:flutter/src/widgets/navigator.dart:1270:19)
22:05:02.446 8 info flutter.tools E/flutter (13216): #2
Navigator.pushReplacement
(package:flutter/src/widgets/navigator.dart:952:22)