10 Notes
+ Sample applications (Jan. 27, 2023, 11:41 p.m.)

# Get the list of sample applications flutter create --list-samples test.json # Create a project with a sample project flutter create --sample=widgets.SingleChildScrollView.1 my_sample

+ Create Project (Jan. 25, 2023, 10:28 p.m.)

flutter create my_app

+ Check the list of connected devices (June 11, 2022, 7:35 p.m.)

Android emulator: flutter emulators Android device: flutter devices

+ HAXM - Hardware Accelerated Execution Manager (April 3, 2022, 2:24 p.m.)

HAXM is only needed on Windows and OS X. On Linux, you need to have KVM installed.

+ Installation (April 3, 2022, 12:25 p.m.)

1- Download the Flutter SDK SDK from the following page: https://docs.flutter.dev/get-started/install/linux#install-flutter-manually 2- Extract it and add the path to .bashrc file: vim ~/.bashrc export PATH="$PATH:[PATH_OF_FLUTTER_DIRECTORY]/bin" Replace the PATH_OF_FLUTTER_DIRECTORY with the path you extracted the tar file.

+ Parsing complex JSON in Flutter (March 29, 2020, 5:23 p.m.)


+ BloC Description (March 26, 2020, 5:57 p.m.)

Think of a stream as a pipe filled with water that flows from the A-side to the B-side. Let’s say you are in side-A and want to send some colorful tiny children’s balls to side-B. You sink these balls one after the other inside the pipe and the water will transport them to side-B one by one in a stream fashion. The balls exit the pipe from side-B. Let’s say they fall and make a noise. Let’s say there is another person inside-B waiting for the balls. Because this person doesn’t know when exactly a ball arrives, he decided to read a newspaper. It’s only when he hears the sound of a ball that he is aware of the arrival of a ball. At that time, he can catch the ball and make use of it. In real BloC: - The pipe is StreamController - The flow of water is StreamController.stram - The action of pushing balls from A-side is StreamController.sink - The colorful children’s balls are data of any type - The person in the side-B listening to the ball falling is StreamController.stram.listen. ------------------------------------------------------------------------- For each of your variables you need to define five things: 1- Your variable name 2- StreamController 3- Stream 4- Sink 5- Close StreamController ------------------------------------------------------------------------- class YourBloc { var yourVar; final yourVarController = StreamController<yourType>(); Stream<yourType> get yourVarStream => counterController.stream; StreamSink<yourType> get yourVarSink => counterController.sink; yourMethod() { // some logic staff; yourVar = yourNewValue; yourVarSink.add(yourVar); } dispose() { yourVarController.close(); } } -------------------------------------------------------------------------

+ setState method description (March 26, 2020, 5:43 p.m.)

Flutter is declarative. This means that Flutter rebuilds its user interface (UI) from scratch to reflect the current state of your app each time setState() method is called.

+ BLoC (March 26, 2020, 11:58 a.m.)

BLoC stands for Business Logic Controller. It was created by Google and introduced at Google I/O 2018. It is created based on Streams and Reactive Programming. These are the classes that act as a layer between data and UI components. The BLoC listens to events passed from it, and after receiving a response, it emits an appropriate state. ------------------------------------------------------------------------- StreamController: Allows sending data, error and done events on its stream. This class can be used to create a simple stream that others can listen on, and to push events to that stream. ------------------------------------------------------------------------- BloC pattern is often used with the third party library RxDart because it has many features not available in the standard dart StreamController. -------------------------------------------------------------------------