Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The fuction 'MyApp' is not defined #46

Open
ghost opened this issue Dec 6, 2020 · 6 comments
Open

The fuction 'MyApp' is not defined #46

ghost opened this issue Dec 6, 2020 · 6 comments

Comments

@ghost
Copy link

ghost commented Dec 6, 2020

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

@sdoshi983
Copy link

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

@valen-developer
Copy link

Simply, import MyApp in your widget_test.dart.

@JaiAravindh-git
Copy link

I would like to be assigned to this

@Ritik609
Copy link

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.

@01mahdivalipoor
Copy link

01mahdivalipoor commented Apr 15, 2021

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

@Harikrishnan001
Copy link

Harikrishnan001 commented Jun 1, 2021

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants