简体   繁体   English

我怎样才能确保我的 main.dart 是正确的?

[英]How can I make sure that my main.dart is correct?

This is my main.dar and I got problems:这是我的 main.dar,我遇到了问题:

import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hive_flutter/adapters.dart';
import 'package:pomodoroTimer/1.app_bar_pomodoro/profile/colors.dart';

import 'apilar_codigo/stacked_all.dart';


void main() async {
  // initialize hive
  await Hive.initFlutter();

  // open a box
  await Hive.openBox("Habit_Database");
 

  
}

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
          textTheme: GoogleFonts.nunitoTextTheme(Theme.of(context).textTheme),
          useMaterial3: true,
          colorScheme:
               ColorScheme.light(primary: ColorsToAPP.selectText)),
      home: const StackePages(),
    );
  }
}

Is there a piece of code that I'm missing out?我错过了一段代码吗? because I can't run the app因为我无法运行该应用程序

Thanks for any help you can provide感谢您的任何帮助,您可以提供

How can I run main.dart without problems?我怎样才能毫无问题地运行 main.dart?

You are missing the code that will actually run the app:您缺少实际运行该应用程序的代码:

void main() async {

...

  runApp(MyApp());

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM