Reputation: 43
I hope your all staying safe! I have been working through the NetNinja's tutorial on Flutter, Google's open source, cross-platform app framework powered by Dart. I have been following along with the tutorials, and have had no problem. However, when I started a new Flutter Project, it's not working. I ran this simple code:
import 'package:flutter/material.dart';
void main() => MaterialApp(
home: IdCard(),
);
class IdCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Id Card"),
centerTitle: true,
backgroundColor: Colors.grey[850],
),
);
}
}
However, when I open the app in iOS simulator, I get a blank screen. When I ran on debug mode, I got an error on line 53 of object_patch.dart, which is part of the Dart SDK. The error said NoSuchMethodError (NoSuchMethodError: The getter 'debugDidSendFirstFrameEvent' was called on null
. It was on this line:
throw new NoSuchMethodError.withInvocation(this, invocation);
I am not getting any other errors in the console In VSCode, I ran Debug my code + packages + SDKs, which didn't return errors. flutter doctor
didn't return iOS or Dart related errors (it complains about android studio). I ran flutter run -v, which returned no errors. The last 1000 lines of it's output are available here (iTerm limits scrollback to 1000 lines.)
Thanks in advance for any help!
Upvotes: 0
Views: 1719
Reputation: 27197
You forgot to runApp.
void main() => runApp(MaterialApp(
home: IdCard(),
));
Upvotes: 1