import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("Example"),
        ),
        body: Center(
          child: Text("Body Example"),
        ),
      ),
    );
  }
}

I was working on my project. After some test an error appear on MaterialApp that "A value of type 'MaterialApp' can't be returned from the method 'build' because it has a return type of 'Widget'.". I didn't change anything in main file of Project.

I tried Create new test Project but, There is same Error on MaterialApp still. I have same Error on Scaffold Widget.

0

There are 0 best solutions below