Farmers in yards world, beautiful application experience, from the programmer for the processing of detail, and self requirements state, agriculture in the yard a member of the young people is busy, every day, every week, can leave some footprints, is the creation of content, there is a persistent, is I don’t know why, if you lost, might as well to Chou Chou code track of farmers.

  • Beautiful musical beats take you through the coding process of this effect
  • Insist on every day, is the pursuit of every ideal youth
  • Follow in the footsteps of young people, and maybe your answer is right here
  • Take a look here if you’re confused

In 2020, I summarized the use of Bloc, Provider and Stream cross-component communication. If you are interested, you can take a look

  • The Flutter Provider communicates asynchronously and manages the Provider status

  • BLoC asynchronous communication, basic use of BlocBuilder, preliminary study of BlocProvider

  • A countdown feature implemented by Flutter StreamBuilder

  • The Flutter StreamBuilder updates data asynchronously

  • The Flutter StreamController communicates asynchronously and the Streamr stream communicates asynchronously

  • Flutter ValueNotifier communicates asynchronously and ValueListenableBuilder updates data asynchronously


In 2021, the Provider will be expanded to 5.0, making it more convenient to use, so I re-recorded a tutorial, you can click here to see [netease Cloud Video Courses]; Of course, you can also pay attention to the public account (Biglead), video tutorials are first broadcast in the public account for free, there will be technical content released every day.

In Flutter development, cross-component communication and data updates are often referred to as state management. GetX is a lightweight framework for state management. This section describes the basic use of GetX for responsive programming.

In early April 2021, we used GetX extensively in application development. So far, it seems that the results are good, so I recently published a set of GetX from the beginning to the source principle analysis tutorial, welcome everyone to pay attention to the update.

  • [1 GetX basically uses route management]
  • 【2 GetX use the starter counter 】

The first step uses GetMaterialApp

// Program entry
void main(a) {
  runApp(RootApp());
}

class RootApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // Use GetX first step
    return GetMaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      // The default home page is displayedhome: CountObsMainPage(), ); }}Copy the code

GetMaterialApp is important for routing, snackbar, internationalization, bottomSheet, dialogs, and high-level apis related to routing and without context. It is just a Widget, Its child component is the default MaterialApp.

The second step defines the Controller


import 'package:get/get.dart';

// the first step is to define the Controller
class CountController extends GetxController{

  // Declare the observed
  RxInt _count = 0.obs;

  RxInt get getCount => _count;

  // Do the following
  void addCount(a) { _count++; }}Copy the code

The third step is to manipulate data and display data

You don’t even need to use the StatefulWidget. Here’s the code:

class CountObsMainPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Gex Response programming"),
      ),
      backgroundColor: Colors.white,

      /// Fill the layout
      body: Container(
          padding: EdgeInsets.all(30),
          width: double.infinity,
          height: double.infinity,
          child: Column(
            children: [
              
              
              GetX<CountObsController>(
                // Initialize the controller
                init: CountObsController(),
                // Listen for the callback
                builder: (CountObsController controller) {
                  return Text("The current count value is ${controller.getCount}"); },),// The observer updates automatically
              Obx(() {
                return Text(
                    ${get. find
      
       ().getCount}"
      ); })],)),// Click the button to change the valuefloatingActionButton: FloatingActionButton( child: Icon(Icons.add), onPressed: () { Get.find<CountObsController>().addCount(); },),); }}Copy the code

The completion of

Not limited to thinking, not limited to language restrictions, is the highest realm of programming.

With xiaobian character, must be to record a set of video, and then upload

If you are interested, you can follow the public account Biglead to get the latest learning materials