0, About scientific Clone flutter
Git config –global http.github.com.proxy socks5://127.0.0.1:
Git config –global –unset http.github.com.proxy)
1. An error occurs in the dependency library corresponding to Pubspec. yaml during compilation
Enter the command “flutter pub get”. The main problem is that some dependent libraries are not compatible with flutter 1.0 after the upgrade to flutter 2.0
YAML syntax
The library intl for flutter internationalization
Internationalization of Flutter application
Flutter ARB file (.arb)
Dart2’s pubspec file
Dart2’s Package dependencies
-
Dependencies: The dependencies are compiled as part of the APP’s code to generate the final installation package
-
Dev_dependencies: These are toolkits for development and test efficiency, such as the automated test package for Flutter
-
Dependency_overrides: this property can be used for “override dependencies”, such as a test release of a previously dependent library for a project dependency
2. The compilation and construction time is too long
Remember to check the Build. gradle configuration of the Android project to see if it is configured for your existing environment to avoid unnecessary downloads
4, /Android/ SDK /ndk-bundle did not have a source.properties file
Dir =< local NDK path > in the Android module local.properties file. If there is a problem, it is the NDK version.
5, runApp (const GalleryApp ());
prefer_const_constructors
Deconstructing Dart Constructors
Dart2 using-constructors
6. Mixin, with, on
Adding features to a class: mixins
Dart Mixins in detail
Constructors are not inheritance
Mixin
7, Dart?? The operator
Reference operator
Cascade notation (..)
Cascade (..) Allows you to create a sequence of operations on the same object. In addition to function calls, you can also access fields on the same object. This often eliminates the need to create temporary variables and allows you to write code more smoothly.
Using single quotes
/// b is assigned value only if b is empty otherwise the value of b remains unchanged b?? = value;
7.1,The extension operator for the collection
The basic class of Flutter — Key
Keys! What are they good for?
The role of Key in Flutter
9 MaterialApp.
BottomNavigationBar
10. App name and Icon configuration
Change Application Name and Icon in Flutter project(Android and iOS)
flutter_launcher_icons
dev_dependencies:
flutter_launcher_icons: "latest version"
flutter_icons:
android: true
ios: true
image_path: "assets/icon/icon.png"
Copy the code
11. Dart2 “header file” — export keyword
Dart2 keyword
Organizing a library package
Part and Part of (not recommended)
12, Flutter Bloc
Bloc Packages
Bloc source code and examples
Flutter official Cookbook
Architect your Flutter project using BLOC pattern
Getting Started with the BLoC Pattern
Introduction to Flutter BLoC Pattern | Flutter Bloc tutorial with Example
Cubit &Bloc:
Cubit benefits: Simple, concise, and less code. Cubit (state only), bloc(state, event and mapEventToState). You do not need to use Async * or understand the concept of yield*, just call emit for state switching.
Bloc advantages:
- High traceability: Bloc’s greatest advantage is the ability to know the sequence of events that trigger the change in state. This can be a big advantage for features that need to be aware of state changes. The most common example is probably authentication/login.
- Another area where Bloc is superior to Cubit is that we need to use reactive operators, such as Buffer, debounceTime, throttle, etc. For example, if we needed to implement an instant search function, we would want to reduce requests to the server (debounce) to avoid hitting the ceiling and reduce the server load. In Bloc, you can override transformEvents to change the handling of incoming events.
conclusion
Cubit significantly reduces the complexity of using Bloc and reduces the Boilerplate code, while still operating with Bloc compatibility. For new developers, getting started is even easier. Also because it is compatible with bloc, if you do not know whether to use Cubit or Bloc implementation at the beginning of the selection, it is suggested to use Cubit implementation first, and if necessary, it can still quickly rebuild bloc!
Flutter framework structure, memory management, thread communication
How is Flutter cross-platform
Principle of Flutter
Overview of the Flutter architecture
Dart Memory Management mechanism (or here)
Dart Memory mechanism
Flutter: Don’t Fear the Garbage Collector
Isolate Threads that do not share memory
Garbage collection mechanism in Flutter
In-depth understanding of the Flutter engine threading pattern
Async widgets
Flutter thread model
Gain a deep understanding of the PROCESS of Flutter creation
The Dart code of Flutter runs on root ISOLATE by default, even for asynchronous future methods that are created. For time-consuming methods, the UI thread will block and stall. To solve this problem, a new ISOLATE needs to be created for time-consuming operations. The ISOLATE adopts a design that does not share memory between multiple threads in the same process. The DART language is designed this way to prevent thread contention. Since memory data cannot be shared among the ISOLates, the SendPort/ReceivePort Port communication mechanism was designed to enable the isolates to communicate with each other independently. The realization principle of port communication is actually asynchronous message mechanism. Dart’s Isolate is managed by the Dart VM and is not directly accessible to the Flutter engine.
After reading the entire source code of the ISOLATE, you can see that each time a new ISOLATE is created, an OSThread is created using pthread_create(). The job of the ISOLATE is to run in this thread. In fact, the ISOLATE is a kind of thread that does not share memory. The ISOLATE simply encapsulates the existing threads in the system. You can use Dart_CreateIsolate and Dart_ShutdownIsolate to create and shut down an ISOLATE.
Everything you might need to know about Flutter is here
14. Dart2 equal
Equatable PackagePub:
Used to prevent Dart2 from writing template code like the one below
- @override bool operator ==(Object other) =>
- @override int get hashCode =>
class EquatableDateTime extends DateTime with EquatableMixin {
@override List<Object> get props { return [year, month, day, hour, minute, second, millisecond, >microsecond]; }... }Copy the code
class EquatableDateTimeSubclass extends EquatableDateTime { final int century; . @override List<Object> get props => super.props.. addAll([century]); }Copy the code
Fluter code specification tool (Lint)
pedantic
effective_dart
16, BlocProvider
The flutter_bloc BlockProvider
Blocprovider-class source code in detail
Insight into state management -BLoC
TODO: Why does the body: BlocBuilder builder function fire 3 times in the flutter_complex_list ListPage?
TODO: Extends BlocProvider error
17,Switching platform
18,PageView parallax implementation
19,Flutter official Widget video collection
20,In-depth understanding of Flutter constraint layout
First, the upper widgets pass constraints to the lower widgets;
The lower-level widgets then pass size information to the upper-level widgets.
Finally, the upper-layer widgets determine the location of the lower-layer widgets.
21. How Flutter works
The Chinese version of
The English version
The most commonly used “four trees” for rendering layouts
Four trees in detail
Flutter layout debugger –> Widget tree
☞ Principle of Flutter operation
The Widget class
Widgets are used to describe the configuration of elements.
A good graphic series analysis of Widget, Element source
22,A suggestion for Flutter subcontracting
23. Route Flutter
Official control Navigate
- Commonly used frameworks:
fluro
flutter_modular
24. Flutter and Compose are programmed in the same way
Start thinking declaratively
Compose programming idea
Takeaways comparing Flutter to Jetpack Compose
Declarative code is good Flutter code
Introduction to declarative UI
Simple app state management
Understand FlutterState
final _LocalizationsScope? scope = context.dependOnInheritedWidgetOfExactType<_LocalizationsScope>();
Copy the code
abstract class State<T extends StatefulWidget> with Diagnosticable
Copy the code
BuildContext dependOnInheritedWidgetOfExactType method?
- ephemeral-vs-appDefinition in:
A more useful definition of state is “data you need whenever you need to rebuild your user interface.” Second, the state you need to manage yourself can be divided into two conceptual types: ephemeral state and app state.”
- Transient state (sometimes referred to as user interface (UI) state or local state) is a state that you can completely include in a separate widget.
The rest of the widget tree does not need access to this state. There is no need to serialize the state, and the state does not change in complex ways.
In other words, there is no need to use a state management architecture (e.g., ScopedModel, Redux) to manage this state. All you need is a StatefulWidget. The setState method of State is used in conjunction with the StatefulWidget to manage short-time State.
Apply performance optimization best practices to Flutter
Flutter Hook
Why don’t Flutter Hooks get much attention and attention?
Hooks In Flutter
Flutter Hooks, say goodbye to StatefulWidget and reduce boilerplate code.
WidgetsBinding
How does Flutter App work
In-depth understanding of Flutter application startup
The internal workings of Flutter
3 Types of Widgets
RenderObjectWidget, ProxyWidget, StatelessWidget, and StatefulWidget (component)
flutter-lifecycle-widgets
Exploration and practice on the governance of Flutter package size
Summary of the Android-Flutter interview
Flutter WidgetsBindingObserver
Listening visibility
Flutter Lifecycle for Android and iOS Developers
Flutter abnormal report
Flutter Zone area