参考

Flutter pub 官网:https://pub.dev/packages/get#about-get
Github: https://github.com/jonataslaw/getx
文档:https://chornthorn.github.io/getx-docs/index

三个基本原则:

  • Performance:
    • GetX专注性能和最小资源消耗。它不使用Streams或ChangeNotifier。
  • Productivity
  • Organization

    使用getX

    新建一个flutter项目,并引入getx。
    image.png
    在代码中将MaterialApp修改为GetMaterialApp
    image.pngimage.png
    可以看到,counter APP可以正常+1。

GetMaterialApp没有修改MaterialApp,它是一个预配置Widget,是将默认的MaterialApp作为它的子widget。