Search
 
SCRIPT & CODE EXAMPLE
 

DART

flutter Scaffold.of() called with a context that does not contain a Scaffold

This exception happens because you are using the context of the widget that
instantiated Scaffold.
Not the context of a child of Scaffold.
You can solve this by just using a different context :

Scaffold(
    appBar: AppBar(
        title: Text('SnackBar Playground'),
    ),
    body: Builder(
        builder: (context) => 
            Center(
            child: RaisedButton(
            color: Colors.pink,
            textColor: Colors.white,
            onPressed: () => _displaySnackBar(context),
            child: Text('Display SnackBar'),
            ),
        ),
    ),
);
Comment

PREVIOUS NEXT
Code Example
Dart :: paste clipboard flutter 
Dart :: flutter convert list dynamic to list string 
Dart :: dart list 
Dart :: flutter widget destructor 
Dart :: flutter color 
Dart :: convert datetime to TZDateTimeflutter 
Dart :: carousel in flutter curved images onpressed 
Dart :: flutter crop captured image 
Dart :: most used extentions for flutter 
Dart :: flutter scaffold floating action button bottom padding remove 
Dart :: remove .0 flutter 
Dart :: flutter set default language 
Dart :: How use late in Dart 
Dart :: install fvm in flutter using pub package 
Dart :: restrick platform orientation flutter 
Dart :: create and validate flutter forms 
Dart :: nullable conditional assignment dart 
Dart :: add sound to my flutter app 
Dart :: flutter container padding 
Dart :: flutter list key value 
Dart :: how to add image to flutter 
Swift :: swift ui open link in browser 
Swift :: convert image to base64 in swift ui 
Swift :: play sound swift stack overflow 
Swift :: swift + time delay call main thread 
Swift :: remove back button swift 
Swift :: swift constraint center vertically 
Swift :: swift convert decimal to string 
Swift :: swift replace all characters except numbers 
Swift :: swift string concatenation 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =