g_state library

The current library is sourced from getx and currently only intercepts content related to state management

Classes

FullLifeCycleController
A controller with super lifecycles (including native lifecycles)
GBind<T>
GBindElement<T>
The BindElement is responsible for injecting dependencies into the widget tree so that they can be observed
GBinder<T>
GBinds
GBuilder<T extends GSController>
GEngine
GetxService
Unlike GetxController, which serves to control events on each of its pages, GetxService is not automatically disposed (nor can be removed with GS.delete()). It is ideal for situations where, once started, that service will remain in memory, such as Auth control for example. Only way to remove it is GS.reset().
GSController
GSInterface
GetInterface allows any auxiliary package to be merged into the "Get" class through extensions
GState<T extends GLifeCycleMixin>
GStateState<T extends GLifeCycleMixin>
GView<T>
GetView is a great way of quickly access your Controller without having to call GS.find
GWCache
GWCacheElement
GWidget<S extends GLifeCycleMixin>
GetWidget is a great way of quickly access your individual Controller without having to call GS.find
InstanceInfo
Observer
Obx
The simplest reactive widget in GState.
ObxElement
ObxStatelessWidget
A StatelessWidget than can listen reactive changes.
ObxValue<T extends RxInterface>
Similar to Obx, but manages a local state. Pass the initial data in constructor. Useful for simple local states, like toggles, visibility, themes, button states, etc. Sample: ObxValue((data) => Switch( value: data.value, onChanged: (flag) => data.value = flag, ), false.obs, ),
ObxWidget
The ObxWidget is the base for all GState reactive widgets
Rx<T>
Foundation class used for custom Types outside the common native Dart types. For example, any custom "Model" class, like User().obs will use Rx as wrapper.
RxBool
RxController
A clean controller to be used with only Rx variables
RxDouble
RxInt
RxList<E>
Create a list similar to List<T>
RxMap<K, V>
Rxn<T>
RxnBool
RxnDouble
RxnInt
RxnNum
RxnString
Rx class for String Type.
RxNum
RxSet<E>
RxString
Rx class for String Type.
ValueBuilder<T>
Manages a local state like ObxValue, but uses a callback instead of a Rx value.
ValueBuilderState<T>
WidgetCache<T extends GWCache>

Enums

SmartManagement
GState by default disposes unused controllers from memory, Through different behaviors. SmartManagement.full SmartManagement.full is the default one. Dispose classes that are not being used and were not set to be permanent. In the majority of the cases you will want to keep this config untouched. If you new to GState then don't change this. SmartManagement.onlyBuilder only controllers started in init: or loaded into a Binding with GS.lazyPut() will be disposed. If you use GS.put() or GS.putAsync() or any other approach, SmartManagement will not have permissions to exclude this dependency. With the default behavior, even widgets instantiated with "GS.put" will be removed, unlike SmartManagement.onlyBuilders. SmartManagement.keepFactoryJust like SmartManagement.full, it will remove it's dependencies when it's not being used anymore. However, it will keep their factory, which means it will recreate the dependency if you need that instance again.

Mixins

FullLifeCycleMixin
GetxServiceMixin
Allow track difference between GetxServices and GetxControllers
GLifeCycleMixin
The GetLifeCycle
ScrollMixin
this mixin allow to fetch data when the scroll is at the bottom or on the top
StatelessObserverComponent
a Component that can track changes in a reactive variable

Properties

GS → _GSImpl
final

Functions

ambiguate<T>(T? value) → T?
This allows a value of type T or T? to be treated as a value of type T?.
defaultLogWriterCallback(String value, {bool isError = false}) → void
default logger from GState

Typedefs

AsyncInstanceBuilderCallback<S> = Future<S> Function()
DidUpdateWidgetCallback<T> = void Function(GBinder<T> oldWidget, GBindElement<T> state)
GControllerBuilder<T extends GLifeCycleMixin> = Widget Function(T controller)
GStateControllerBuilder<T extends GLifeCycleMixin> = Widget Function(T controller)
InitBuilder<T> = T Function()
InstanceBuilderCallback<S> = S Function()
InstanceCreateBuilderCallback<S> = S Function(BuildContext _)
LogWriterCallback = void Function(String text, {bool isError})
VoidCallback from logs
ValueBuilderBuilder<T> = Widget Function(T snapshot, ValueBuilderUpdateCallback<T> updater)
ValueBuilderUpdateCallback<T> = void Function(T snapshot)
ValueUpdater<T> = T Function()
WidgetCallback = Widget Function()

Exceptions / Errors

GBindError<T>