[dart] learning record of dart constructor (including the writing method of dart singleton mode)

Normal constructor 1. Without specifying the constructor, dart will create a default parameterless constructor for you 2. If you specify a constructor Similar to Java, dart can use a function with the same name as class as its constructor, such as class Student { int age = 0; int id = 0; Student(int age, int id) { this.age = age; ...

Posted by NoPHPPhD on Fri, 05 Aug 2022 22:03:36 +0300

Flutter basic routing management, use of Fluro library and secondary encapsulation

In native development, Android and IOS have their own control page (Activity, ViewControl) function to jump, and in flutter, routing management has become more unified, flexible and efficient. Routing Management Requirements In Flutter, everything is a component, a page is also a component, and routing is a jump and value transfer between compo ...

Posted by dotbands on Tue, 24 May 2022 15:17:08 +0300

Flutter status management Provider

In fluent, state management is the top priority. Whenever we talk about this topic, there are always endless words. After formally introducing the Provider, why do we need state management. If you already know this clearly, it is recommended to skip this section directly.If our application is simple enough, as a declarative framework, you may o ...

Posted by bickyz on Mon, 23 May 2022 06:06:52 +0300

Standardize code naming to make your Dart code more pleasant to read

Click here to learn about the "Flutter Introduction and Combat" column, continuous update and systematic learning! foreword Good coding style is very important. Keeping consistent naming can make the code reading experience better and team collaboration more efficient. This article introduces the officially recommended naming conven ...

Posted by MBrody on Thu, 19 May 2022 02:17:31 +0300

[Flutter combat]Menu function

Lao Meng's introduction: Today, I will introduce the menu function in Flutter. PopupMenuButton Use PopupMenuButton to pop up a menu when clicked. The usage is as follows: PopupMenuButton<String>( itemBuilder: (context) { return <PopupMenuEntry<String>>[ PopupMenuItem<String>( value: 'language', ...

Posted by phpmixx on Tue, 17 May 2022 22:56:10 +0300

flutter dio network request encapsulation implementation

flutter dio network request encapsulation implementation Article Links:   https://juejin.im/post/6844904098643312648 There are two ways to use network requests in the Flutter project, which are Dart's native network request HttpClient class and third-party open source network request libraries. In the third-party http request library open ...

Posted by wigz01 on Tue, 17 May 2022 10:00:04 +0300

Globally monitor routing stack changes

Lao Meng's introduction: Many times we need to monitor the changes of the routing stack, so that we can customize the routing stack and facilitate the analysis of exception logs. Use RouteObserver to listen for changes in the routing stack, first add navigatorObservers to the MaterialApp component: void main() { runApp(MyApp()); } RouteOb ...

Posted by sgtbash on Tue, 17 May 2022 08:34:57 +0300

Fluent asynchronous programming - event loop, Isolate, Stream

Event loop, Isolate Before we start, we need to understand that Dart is single threaded and that fluent depends on Dart If you know event loop in js The whole process of asynchronous dart is well understood Let's look at a piece of code first import 'dart:async'; Future eventLoop() async{ print('A'); Future((){ print('F'); scheduleMicrota ...

Posted by WinterDragon on Mon, 16 May 2022 23:21:38 +0300

100 lines of code to realize Flutter custom TabBar

Flutter is really powerful, but the fly in the ointment is that the ecology needs to be improved. There is no universal basic UI library like Antd or Element in the front end. The direct impact of this is that the development efficiency can not be improved, and it needs to spend a lot of time and energy on the packaging of basic components. T ...

Posted by yoda69 on Sat, 14 May 2022 13:01:24 +0300

Flutter&Dart Callback to synchronization

foreword How to convert a Callback callback into a Future synchronization method (Callback to Future), which can be used with async / await? Personally, I think this is a very common phenomenon. I don’t know why. Many people didn’t mention this scene when explaining the usage of Future. course Why should I convert Callback to Futur ...

Posted by nootkan on Tue, 10 May 2022 04:46:13 +0300