Last updated:
0 purchases
lce
Flutter LCE (Load content error) #
这是一个 Flutter LCE 实现
Getting started #
项目增加库依赖
flutter pub add lce
copied to clipboard
可选依赖(用于支持 @LCECatch 注解)
flutter pub add lce_codegen
copied to clipboard
Usage #
1. 页面 store #
class MyHomePageStore = _MyHomePageStoreBase with _$MyHomePageStore;
/// 创建 mobx store 并继承 LCEStore
abstract class _MyHomePageStoreBase extends LCEStore with Store {
@observable
var counter = 0;
}
copied to clipboard
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}',
);
},
),
);
}
}
copied to clipboard
Additional information #
更多内容详见 example
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.