Skip to content

The fuction 'MyApp' is not defined  #46

Open

Description

my code is right but I don't know why it is showing issue.
By the way I use Ubuntu
Error

Activity

  1. sdoshi983 commented on Dec 7, 2020

    @sdoshi983

    my code is right but I don't know why it is showing issue.
    By the way I use Ubuntu
    Error

    The solution can be found out here

  2. valen-developer commented on Jan 10, 2021

    @valen-developer

    Simply, import MyApp in your widget_test.dart.

  3. JaiAravindh-git commented on Feb 3, 2021

    @JaiAravindh-git

    I would like to be assigned to this

  4. Ritik609 commented on Feb 26, 2021

    @Ritik609

    Actually This is a warning. Better you should define a class MyApp and call this class under runApp.
    Example:
    void main() {
    runApp(MyApp());
    }

    class MyApp extends StatelessWidget {
    @OverRide
    Widget build(BuildContext context) {
    return MaterialApp(
    title: 'Flutter Demo',
    debugShowCheckedModeBanner: false,
    theme: ThemeData(
    scaffoldBackgroundColor: Color(0xff1f1f1f),
    primarySwatch: Colors.blue,
    ),

    I think this may solve this warning.

  5. 01mahdivalipoor commented on Apr 15, 2021

    @01mahdivalipoor

    if you dont test your app, you can delete test folder for now.

  6. Harikrishnan001 commented on Jun 1, 2021

    @Harikrishnan001

    When we create a flutter project, by default flutter create a test folder that contains widget_test.dart. Inside that, the pumpWidget method requires a widget to build our app and trigger a frame. It is not necessary but can be used for widget testing purposes. By default, it takes a widget named MyApp which is the first root widget that flutter creates for you. I assume that you might have removed the boilerplate code, which in turn removed that widget. You can either provide the name of the root widget(the widget given to the runApp method) as an argument to that method or create a widget named MyApp which is the root widget. You can also just ignore the warning or delete the folder widget_test.dart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions