If you have great ideas,
Let's talk!

blog

Flutter 基础 记录

编程export

https://docs.flutter.dev/cookbook

https://docs.flutter.dev/get-started/fundamentals

Where does initialization code go?

The main entrypoint in a starter Flutter app is in lib/main.dart. The default main method looks like the following:

lib/main.dart

dart

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

content_copy

Perform any quick initialization (less than a frame or two) before calling runApp(), though be aware that the widget tree hasn’t been created yet. If you want to perform initialization that takes awhile, such as loading data from disk or over a network, do it in a way that won’t block the main UI thread. For more information, check out Asynchronous programming, the FutureBuilder API, Deferred components, or the Working with long lists cookbook recipe, as appropriate.

Every stateful widget has an initState() method that is called when the widget is created and added to the widget tree. You can override this method and perform initialization there, though the first line of this method must be super.initState().

Finally, hot reloading your app does not call initState or main again. Hot restart calls both.

image.png

先不看了 试着做个app 边做边看看需要啥吧