flutter_obx 0.0.4 copy "flutter_obx: ^0.0.4" to clipboard
flutter_obx: ^0.0.4 copied to clipboard

Simple state management for flutter

Integation Tutorial #

  1. Create a State Like this

classHomeState { int? count; HomeState({ this.count, }); HomeState copyWith({int? count}) { return HomeState(count: count ?? this.count); } }

  1. Then import'package:flutter_obx/flutter_obx.dart';
  2. After importin the plagin create controller like this

Obx<HomeState> homeController=Obx<HomeState>( value:HomeState( count:0, ));

  1. Ater this use ObxProvider for reflect value in ui.

ObxProvider<HomeState>( obxController:homeController, builder: (BuildContext context, HomeState value, Widget? child) { return SizedBox( width:MediaQuery.of(context).size.width, child:Column( mainAxisAlignment:MainAxisAlignment.center, children:<Widget>[ const Text( 'You have pushed the button this many times:', ), Text('${value.count}',), ],), );}

  1. For update value follow this.

    homeController.emit(homeController.obs.copyWith(count:count+1));

1
likes
0
points
24
downloads

Publisher

unverified uploader

Weekly Downloads

Simple state management for flutter

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_obx