Flutter
10 Notes
# 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
flutter create my_app
Android emulator: flutter emulators Android device: flutter devices
HAXM is only needed on Windows and OS X. On Linux, you need to have KVM installed.
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.
https://medium.com/flutter-community/parsing-complex-json-in-flutter-747c46655f51
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(); } } -------------------------------------------------------------------------
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 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. -------------------------------------------------------------------------
Hiding the Bottom Navigation Bar on Scroll: https://medium.com/flutter/getting-to-the-bottom-of-navigation-in-flutter-b3e440b9386 -------------------------------------------------------------- https://medium.com/@theboringdeveloper/common-bottom-navigation-bar-flutter-e3693305d2d --------------------------------------------------------------