learning flutter

Flutter is a multiplatform UI Framework that uses the Dart programming language. Dart includes a Dart VM with just in time (JIT) compilation (for dev hot reloading) and an ahead-of-time (AOT) compiler for producing machine code.
for web Dart can compile to JS and WASM.

The Dart language syntax is very similar to JS/TS

install

follow install guide on oficial site.
run flutter doctor to verify flutter instalation.
deps:

create project with flutter create myapp and run with flutter run
flutter hot reload doesn't reset state, hot reset does.

how to run ios or android emulator:

resources

theory

learning dart

everything is a widget, like react components
widgets by default are stateless
'wiget is an immutable description of a part of a UI'. so flutter is declarative in a sense.

There are layout widgets like Column and Row.

entry point of an app is main.dart and the void main() => runApp(); function

widgets must have a build() method

class MyApp extends StatelessWidget{
    @override
    Widget build(BuildContext context){
        return MaterialApp(
            title:'myapp',
            theme: ThemeData(primarySwatch: Colors.blue)
        );
    }
}
// `Widget` is the return type of the build fn

state

setState() triggers a re-rendering of the widget, by running the widget's build method again.

a stateful widget is separated into two classes StatefulWidget (this is the class that allows the widget to remain immutable) and a accompanying _FooState extends State<Foo>

to initialize data (like making a req to API) in a stateful widget use the void initState() method. There is also the dispose() method that runs when the widget is removed from the UI.

there are other state management solutions that don't require you to use stateful widgets at all like 'provider' and 'cubit'

there is navigator 1.0 and 2.0.
for basic, learn 1.0

pages are in like a stack. navigator push() and navigator pop().