E/flutter(3045):[错误:flutter/lib/ui/ui_dart_state.cc(186)]

时间:2021-04-04 09:59:10

标签: flutter flutter-layout

E/flutter (3045):[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] 未处理的异常:NoSuchMethodError:类“List”没有实例方法“call”。

这是我的代码:

import 'package:flutter/material.dart';

void main(IniApp) => runApp(IniApp(home: IniApp()));

class IniApp extends StatelessWidget { 
  @override Widget build(BuildContext context) { 
    return MaterialApp( 
      home: Scaffold( 
        appBar: AppBar(title: Text("who's is emir"),), 
        body: Column( 
          crossAxisAlignment: CrossAxisAlignment.start, 
          mainAxisSize: MainAxisSize.min, 
          children:[ 
            Center( 
              child:  Center(
              child: Text("Nama Saya Emir Afawan\n"
                  "NIM Saya 20180801028\n"
                  "Hobby Saya Volleyball\n"
                  "Pekerjaan Saya Kuliah\n"
                  "Status Saya Belajar"),
              ),
            ),
          ],
        ),
      ),
    );
  }

1 个答案:

答案 0 :(得分:0)

main 函数有一个奇怪的行为,试图用不存在的 home 参数调用 IniApp。尝试通过调用一次来简化它:void main() => runApp(IniApp());