lce 0.1.1+1 copy "lce: ^0.1.1+1" to clipboard
lce: ^0.1.1+1 copied to clipboard

Flutter LCE(Load Content Error), mobx state management template, which is convenient for handling loading, content and errors.

Flutter LCE (Load content error) #

这是一个 Flutter LCE 实现

Getting started #

项目增加库依赖

flutter pub add lce

可选依赖(用于支持 @LCECatch 注解)

flutter pub add lce_codegen

Usage #

1. 页面 store #

class MyHomePageStore = _MyHomePageStoreBase with _$MyHomePageStore;

/// 创建 mobx store 并继承 LCEStore
abstract class _MyHomePageStoreBase extends LCEStore with Store {
  @observable
  var counter = 0;
}

2. 页面 #

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});
  final String title;
  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

/// 创建页面 State,继承 LCEState
class _MyHomePageState extends LCEState<MyHomePage, MyHomePageStore> {
  @override
  MyHomePageStore initStore() => MyHomePageStore();

  @override
  Widget buildContent(BuildContext context) {
    return Scaffold(
      body: Observer(
        builder: (_) {
          return Text(
            '${store.counter}',
          );
        },
      ),
    );
  }
}

Additional information #

更多内容详见 example

0
likes
120
points
12
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter LCE(Load Content Error), mobx state management template, which is convenient for handling loading, content and errors.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_mobx, meta, mobx

More

Packages that depend on lce