flowr_mvvm library

Classes

BaseFlowR<T>
基础 flow
DisposeMethod
marks an instance method as a dispose call back to be passed to GetIt
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
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
FlowR<T>
FlowR --- Basic mixin --- BaseFlowR 核心基础功能: 使用Stream传递数据 UpdatableMx 提供 update 方法, 自动捕获异常 LoggableMx 打印putError的异常于StackTrace
FrFutureBuilder<VM extends FrViewModel>
FrMultiProvider
FrProvider<VM extends FrViewModel>
  • Provider
  • FrStreamBuilder<VM extends FrViewModel, T>
    FrView<VM extends FrViewModel, M extends dynamic>
    FrViewFutureBuilder<VM extends FrViewModel, M extends dynamic>
    FrViewModel<M extends dynamic>
    2.ViewModel FrViewModel optional mixin TestLoggableMx for test print
    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
    LazySingleton
    Classes annotated with @LazySingleton will generate registerLazySingleton func
    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.
    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
    A utility class that provides static methods to create the various Streams provided by RxDart.
    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
    StreamController<T>
    A controller with the stream it controls.
    StreamSubscription<T>
    A subscription on events from a Stream.
    ValueStream<T>
    An Stream that provides synchronous access to the last emitted item
    ValueStreamBuilder<M, 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<M, T>
    ValueStreamConsumer exposes a builder and listener to react to new values from a stream.
    ValueStreamListener<M, 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.

    Enums

    LogExtra
    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

    Mixins

    DisposeMx
    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
    SubsAutoDisposeMx<M>
    ref flowr/NtfAutoDisposeMx
    TestLoggableMx<T>
    UpdatableMx<T>

    Extensions

    ChangeNotifierX on T
    ref NtfAutoDisposeMx.autoDisposeNotifier FocusNode
    ConnectableStreamExtensions on Stream<T>
    Extends the Stream class with the ability to transform a single-subscription Stream into a ConnectableStream.
    DebounceExtensions on Stream<T>
    Extends the Stream class with the ability to debounce events in various ways
    DistinctByValueX on ValueStream<T>
    DistinctByX on Stream<T>
    DistinctWithValueX on ValueStream<T>
    DistinctWithX on Stream<T>
    DoExtensions on Stream<T>
    Extends the Stream class with the ability to execute a callback function at different points in the Stream's lifecycle.
    FrReadContextX on BuildContext
    MapValueX on ValueStream<T>
    SetX on Set<T>
    SwitchMapExtension on Stream<T>
    Extends the Stream with the ability to convert one stream into a new Stream whenever the source emits an item. Every time a new Stream is created, the previous Stream is discarded.
    WhereNotNullExtension on Stream<T?>
    Extends the Stream class with the ability to convert the source Stream to a Stream which emits all the non-null elements of this Stream, in their original emission order.

    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

    EnvironmentFilterFunc = bool Function(Set<String>)
    FrListener<M, T> = ValueStreamListener<M, T>
    FrModel = dynamic
    FlowR-MVVM
    FrWidgetBuilder<VM extends FrViewModel, M> = Widget Function(BuildContext c, ModelSnapshot<VM, M> s)
  • View FrView
  • ValueStreamBuilderCondition<M, T> = bool Function(T? preDistinct, T? curDistinct, M 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<M> = Widget Function(BuildContext context, M 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<M, T> = void Function(BuildContext context, T? preDistinct, T? curDistinct, M value)
    below code is from rxdart_flutter package; but support rxdart 0.27.0+ 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