Home > Back-end >  Scaffold widgets require a MediaQuery widget anscestor
Scaffold widgets require a MediaQuery widget anscestor

Time:01-23

(This is my first post so please excuse the poor format and mistakes) I hope you all are doing great. I am new to dart and programming, and I can't figuere out how to solve this. enter image description here

.I have tried adding MaterialApp, which seems to be the solution everyone online is recommending but to no avail. please help

import 'package:flutter/material.dart';



void main() => runApp(
  MaterialApp(home: ScaffoldExample())
);

class ScaffoldExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          "Scaffold",),
        centerTitle: true,
      ),
    ); // scaffold
  }
}

CodePudding user response:

run these commands in terminals hope this will help you

>> flutter clean

>> flutter pub get

if this didn't worked try stopping and restarting the app. let me know if this help you or not.

  • Related