flowr_mvvm library

Classes

BaseFlowR<T>
Bloc<Event, State>
Takes a Stream of Events as input and transforms them into a Stream of States as output.
BlocBuilder<B extends StateStreamable<S>, S>
BlocBuilder handles building a widget in response to new states. BlocBuilder is analogous to StreamBuilder but has simplified API to reduce the amount of boilerplate code needed as well as bloc-specific performance improvements. Please refer to BlocListener if you want to "do" anything in response to state changes such as navigation, showing a dialog, etc...
BlocConsumer<B extends StateStreamable<S>, S>
BlocConsumer exposes a builder and listener in order react to new states. BlocConsumer is analogous to a nested BlocListener and BlocBuilder but reduces the amount of boilerplate needed. BlocConsumer should only be used when it is necessary to both rebuild UI and execute other reactions to state changes in the bloc.
BlocListener<B extends StateStreamable<S>, S>
Takes a BlocWidgetListener and an optional bloc and invokes the listener in response to state changes in the bloc. It should be used for functionality that needs to occur only in response to a state change such as navigation, showing a SnackBar, showing a Dialog, etc... The listener is guaranteed to only be called once for each state change unlike the builder in BlocBuilder.
BlocProvider<T extends StateStreamableSource<Object?>>
Takes a create function that is responsible for creating the Bloc or Cubit and a child which will have access to the instance via BlocProvider.of(context). It is used as a dependency injection (DI) widget so that a single instance of a Bloc or Cubit can be provided to multiple widgets within a subtree.
BlocSelector<B extends StateStreamable<S>, S, T>
BlocSelector is analogous to BlocBuilder but allows developers to filter updates by selecting a new value based on the bloc state. Unnecessary builds are prevented if the selected value does not change.
Closable
An object that must be closed when no longer in use.
Cubit<State>
A Cubit is similar to Bloc but has no notion of events and relies on methods to emit new states.
DisposeMethod
marks an instance method as a dispose call back to be passed to GetIt
Emitter<State>
An Emitter is a class which is capable of emitting new states.
Environment
Used to annotate dependencies which are registered under certain environments
EnvironmentFilter
a simple filter function to be used inside SimpleEnvironmentFilter filter for whether to register for the given set of environments clients can extend this class to maker their own environmentFilters
ErrorAndStackTrace
Pair used when reporting a stream error with its stack trace.
ExternalModule
FactoryMethod
Marks a factory, a named constructor or a static create function as an injectable constructor if not added the default constructor will be used
FactoryParam
Marks a constructor param as factoryParam so it can be passed to the resolver function
FlowB<E, S>
Bloc-native FlowR Bloc.
FlowR<T>
Bloc-native FlowR base class.
FrBlocViewModel<E, M extends dynamic>
FrConfig
FlowR global config
FrConsumer<VM extends StateStreamable<M>, M extends dynamic>
FrFutureBuilder<VM extends FrViewModel>
FrListener<VM extends StateStreamable<M>, M extends dynamic>
FrMultiListener
FrMultiProvider
FrProvider<VM extends Object>
  • auto dispose FlowR objects
  • FrService
    FrService
    FrStreamBuilder<VM extends FrViewModel, T extends dynamic>
    FrUnion
    平铺状态, 可通过命名叠加来区分层级
    FrUnionViewModel
    提供一个全局VM, 用于简化代码. ⚠️ 单一全局VM不适用于复杂应用场景, 跨app复用状态可能造成不可预知的错误 与M对应的VM方法,请考虑通过 extension 封装
    FrView<VM extends StateStreamable<M>, M extends dynamic>
    FrViewFutureBuilder<VM extends FrViewModel, M extends dynamic>
    FrViewModel<M extends dynamic>
    FrViewU<M extends FrUnionModel>
    用于从FrUnionViewModel 读取特定状态
    GetIt
    Very simple and easy to use service locator You register your object creation factory or an instance of an object with registerFactory, registerSingleton or registerLazySingleton And retrieve the desired object using get or call your locator as function as its a callable class Additionally GetIt offers asynchronous creation functions as well as functions to synchronize the async initialization of multiple Singletons
    GetItHelper
    a helper class to handle conditional registering
    IgnoreParam
    Constructor params annotated with IgnoreParam will be ignored by when generating the resolver function
    Injectable
    Marks a class as an injectable dependency and generates
    InjectableInit
    // Marks a top-level function as an initializer function for configuring Get_it
    IService
    service
    LazySingleton
    Classes annotated with @LazySingleton will generate registerLazySingleton func
    Level
    Levels to control logging output. Logging can be enabled to include all levels above certain Level. Levels are ordered using an integer value Level.value. The predefined Level constants below are sorted as follows (in descending order): Level.SHOUT, Level.SEVERE, Level.WARNING, Level.INFO, Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST, and Level.ALL.
    LogExtra
    tp null: not print log extra info (dev tips, stack, ...) inner : last FlowR method - This is where you call the ::logger self : (dft) last your CustomViewModel(or other class) method - This is where you call the ::update outer : invoke FlowR method at log.name - This is where you call the method that contains the ::update method all : for dev, print all stack frame info
    Logger
    Use a Logger to log debug messages.
    LogRecord
    A log entry representation used to propagate information from Logger to individual handlers.
    MicroPackageModule
    ModelSnapshot<VM extends FrViewModel, T>
    Module
    marks a class as a register module where all property accessors rerun types are considered factories unless annotated with @singleton/lazySingleton.
    MultiBlocListener
    Merges multiple BlocListener widgets into one widget tree.
    MultiBlocProvider
    Merges multiple BlocProvider widgets into one widget tree.
    Named
    Used to register a dependency under a name instead of type also used to annotated named injected dependencies in constructors
    NoEnvOrContains
    This filter validates dependencies with no environment keys or contain the provided environment
    NoEnvOrContainsAll
    This filter validates dependencies with no environment keys, or the ones containing all the provided environments
    NoEnvOrContainsAny
    This filter validates dependencies with no environment keys, or the ones containing one of the provided environments
    Order
    Classes annotated with @Order will overwrite the automatically generated position of the
    PostConstruct
    methods annotated with postConstruct will be called in a cascade manner after being constructed
    PreResolve
    Futures annotated with preResolve will be pre-awaited before they're registered inside of GetIt
    Provider<T>
    A Provider that manages the lifecycle of the value it provides by delegating to a pair of Create and Dispose.
    Rx
    Scope
    Used to annotate dependencies which are registered under a different scope than main-scope
    SimpleEnvironmentFilter
    A simple filter that can be used directly for simple use cases without having to extend the base EnvironmentFilter
    Singleton
    Classes annotated with @Singleton will generate registerSingleton function
    StateStreamable<State>
    A Streamable that provides synchronous access to the current state.
    StateStreamableSource<State>
    A StateStreamable that must be closed when no longer in use.
    StateValueStream<T>
    StreamController<T>
    A controller with the stream it controls.
    StreamSubscription<T>
    A subscription on events from a Stream.
    ValueStream<T>
    A stream that exposes its latest value and latest error synchronously.
    ValueStreamBuilder<T>
    ValueStreamBuilder handles building a widget in response to new value. ValueStreamBuilder is analogous to StreamBuilder but has simplified API to reduce the amount of boilerplate code needed as well as ValueStream-specific performance improvements.
    ValueStreamConsumer<T>
    ValueStreamConsumer exposes a builder and listener to react to new values from a stream.
    ValueStreamController<T>
    Small test/support controller with ValueStream semantics.
    ValueStreamListener<T>
    Takes a ValueStreamWidgetListener and a stream and invokes the listener in response to value changes in the stream.
    Zone
    A zone represents an environment that remains stable across asynchronous calls.

    Mixins

    DisposeMx
    FlowRMx<T>
    flowr mixin
    FrPageMx<T extends StatefulWidget>
    use 'autoDispose' to register 'StreamSubscription's when page call 'dispose', will call 'disposeAuto' to cancel all subscriptions
    LoggableMx<T>
    使用logger 打印异常信息
    NtfAutoDisposeMx<M>
    ref SubsAutoDisposeMx
    RunCatchingMx
    SlowlyMx
    Mixin for debounce, throttle and Mutex lock. This implementation is powered by Slowly.
    SubsAutoDisposeMx<M>
    ref flowr/NtfAutoDisposeMx
    TestLoggableMx<T>
    UpdatableMx<T>

    Constants

    disposeMethod → const DisposeMethod
    const instance of DisposeMethod with default arguments
    factoryMethod → const FactoryMethod
    const instance of FactoryMethod with default values
    factoryParam → const FactoryParam
    const instance of FactoryParam with default arguments
    ignoreParam → const IgnoreParam
    const instance of IgnoreParam
    injectable → const Injectable
    const instance of Injectable with default arguments
    injectableInit → const InjectableInit
    const instance of InjectableInit with default arguments
    kEnvironmentsFilterName → const String
    kEnvironmentsName → const String
    instance name for the Set of environment keys that's registered internally inside of GetItHelper
    lazySingleton → const LazySingleton
    const instance of LazySingleton with default arguments
    microPackageInit → const InjectableInit
    const instance of InjectableInit.microPackage with default arguments
    module → const Module
    const instance of Module with default arguments
    named → const Named
    const instance of Named with default arguments
    order → const Order
    const instance of Order with default arguments
    postConstruct → const PostConstruct
    const instance of PostConstruct with default arguments
    preResolve → const PreResolve
    const instance of PreResolve with default arguments
    singleton → const Singleton
    const instance of Singleton with default arguments

    Typedefs

    BlocBuilderCondition<S> = bool Function(S previous, S current)
    Signature for the buildWhen function which takes the previous state and the current state and is responsible for returning a bool which determines whether to rebuild BlocBuilder with the current state.
    BlocListenerCondition<S> = bool Function(S previous, S current)
    Signature for the listenWhen function which takes the previous state and the current state and is responsible for returning a bool which determines whether or not to call BlocWidgetListener of BlocListener with the current state.
    EnvironmentFilterFunc = bool Function(Set<String>)
    FrLogRecordPrinter = void Function(LogRecord record)
    FrModel = dynamic
    FrSnap<VM extends StateStreamable, M> = ({M data, VM vm})
    FrUnionModel = Object
    FrViewBuilder<VM extends StateStreamable, M> = Widget Function(BuildContext context, FrSnap<VM, M> s, Widget? child)
    FrWidgetBuilder<VM extends FrViewModel, M> = Widget Function(BuildContext c, ModelSnapshot<VM, M> s)
    FrWidgetListener<VM, M> = void Function(BuildContext context, M previous, M current, VM vm)
    OnLogging<T> = String Function(T prv, T cur)?
    before invoke FlowRMx.put, build log content
    TaggedUnionModel = (FrUnionModel, String)
    ValueStreamBuilderCondition<S> = bool Function(S previous, S current)
    Signature for the buildWhen function which takes the previous and current value and is responsible for returning a bool which determines whether to rebuild ValueStreamBuilder with the current value.
    ValueStreamWidgetBuilder<T> = Widget Function(BuildContext context, T value, Widget? child)
    Signature for the builder function which takes the BuildContext and the current value and is responsible for returning a widget which is to be rendered. This is analogous to the builder function in StreamBuilder.
    ValueStreamWidgetListener<T> = void Function(BuildContext context, T previous, T current)
    ValueStream listener adapted for FlowR's bloc-backed ValueStream contract. Signature for the listener function which takes the BuildContext along with the previous and current value and is responsible for executing in response to value changes.

    Exceptions / Errors

    FlowrError
    base FlowrError
    SkipError
    throw SkipError, for break FlowR.update flowr