How can Error in flutter stateless widget?

39 Views Asked by At

I have a problem in flutter in main.dart page in Stateless widget inside return MyApp( the title: , home: , debugShowCheckedModeBanner: and routes they give me an error "The named parameter 'title /any of them' isn't defined. Try correcting the name to an existing nameed parameter with the name'

class MyApp extends Statelesswidget { @override Widget buil(BuildContext context) { return MyApp( title : 'page', . . ... ); } }

2

There are 2 best solutions below

2
Luis Rodas On

Stateless Widget does not have title and other parameters, those parameters belongs to MaterialApp widget https://api.flutter.dev/flutter/material/MaterialApp-class.html

0
Mohammad Bilal Akbar On

You have to return MaterialApp inside the build method of MyApp class. And then MaterialApp have property title, debugShowCheckedModeBanner, and routes.

enter image description here