79311772

Date: 2024-12-27 12:15:34
Score: 0.5
Natty:
Report link

You seem to be missing the main function which is the entry point and runApp function responsible for launching the app:

main() is the entry point of the app. main() is responsible for launching the app by calling runApp().

The runApp() function takes a widget (usually MaterialApp) and inflates it to display the initial UI on the screen.

Also i noticed you are calling the same class in MaterialApp>home which is not possible to do. Below is your code modified and corrected:

import 'package:flutter/material.dart';

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

class HomeScreen extends StatefulWidget {
   const HomeScreen({super.key});

   @override
   State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
   @override
   Widget build(BuildContext context) {
      return const MaterialApp(
        debugShowCheckedModeBanner: false,
        //home: HomeScreen(), //REQUIRE TO CHANGE THIS TO ANOTHER CLASS
        home: const NewScreen(),
      );
   }
}

Here is the link to better understand main function and different variations.

Reasons:
  • Blacklisted phrase (1): Here is the link
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Newb