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
FlutterError:Scaffold.of() called with a context that does not contain a Scaffold.
NoScaffold ancestor could be found starting from the context that was passed to Scaffold.of(). This usually happens when the context provided is from the same StatefulWidgetas that whose build function actually creates the Scaffold widget being sought.
There are several ways to avoid this problem. The simplest is to use a Builder to get a context that is"under" the Scaffold. For an example of this, please see the documentation forScaffold.of():
https://docs.flutter.io/flutter/material/Scaffold/of.htmlA more efficient solution is to split your build function into several widgets. This introduces a new context from which you can obtain the Scaffold. Inthis solution, you would have an outer widget that creates the Scaffold populated by instances of your new inner widgets, and then in these inner widgets you would use Scaffold.of().
A less elegant but more expedient solution is assign a GlobalKey to the Scaffold, then use the key.currentState property to obtain the ScaffoldState rather than using the Scaffold.of() function.
The context used was:MovieDetailsFile"scaffold.dart", line 1155, inScaffold.of
File"widget_helper.dart", line 45, inWidgetHelper.showSnackbar
File"movie_details_screen.dart", line 303, inMovieDetailsState._downloadFile
File"<asynchronous suspension>"File"movie_details_screen.dart", line 311, inMovieDetailsState._downloadFile
File"<asynchronous suspension>"File"movie_details_screen.dart", line 291, inMovieDetailsState._buildSubtitleDropDown.<fn>File"ink_well.dart", line 511, in_InkResponseState._handleTap
File"ink_well.dart", line 566, in_InkResponseState.build.<fn>File"recognizer.dart", line 166, inGestureRecognizer.invokeCallback
File"tap.dart", line 240, inTapGestureRecognizer._checkUp
File"tap.dart", line 211, inTapGestureRecognizer.acceptGesture
File"arena.dart", line 156, inGestureArenaManager.sweep
File"binding.dart", line 225, in_WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent
File"binding.dart", line 199, in_WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent
File"binding.dart", line 156, in_WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent
File"binding.dart", line 102, in_WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue
File"binding.dart", line 86, in_WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket
File"zone.dart", line 1136, in _rootRunUnary
File"zone.dart", line 1029, in_CustomZone.runUnary
File"zone.dart", line 931, in_CustomZone.runUnaryGuarded
File"hooks.dart", line 233, in _invoke1
File"hooks.dart", line 154, in _dispatchPointerDataPacket
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: