FrBlocViewModel<E, M extends dynamic> class abstract

Inheritance
Implemented types
Mixed-in types

Constructors

FrBlocViewModel(M initialState)

Properties

hashCode int
The hash code for this object.
no setterinherited
isClosed bool
Whether the bloc is closed.
no setterinherited
logExtra LogExtra?
set put log type
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state → M
The current state.
no setterinherited
stream Stream<M>
The current stream of states.
no setterinherited
value → M
Current state value using FlowR's legacy name.
no setterinherited

Methods

add(E event) → void
Notifies the Bloc of a new event which triggers all corresponding EventHandler instances.
inherited
addError(Object error, [StackTrace? stackTrace]) → void
Reports an error which triggers onError with an optional StackTrace.
inherited
autoDispose<T extends StreamSubscription?>(T subs, {String? tag}) → T
inherited
autoDisposeNotifier<N extends ChangeNotifier?>(N ntf, {String? tag}) → N
inherited
close() Future<void>
Close the bloc and dispose FlowR helper resources.
inherited
debounce<R>(Object tag, Duration duration, FutureOr<R> action(), {Duration? maxDuration}) FutureOr<R?>
debounce 防抖: 停止操作后等待 duration 执行最后一次。 maxDuration: 可选,解决“无限重置”问题。如果持续触发超过此时间,强制执行一次。
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
override
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
dispose() → void
inherited
emit(M state) → void
emit is only for internal use and should never be called directly outside of tests. The Emitter instance provided to each EventHandler should be used instead.
inherited
frPrint(String message, {DateTime? time, int? sequenceNumber, int? level, String? name, Zone? zone, Object? error, StackTrace? stackTrace}) → dynamic
inherited
isDebounceLocked(Object tag) bool
检查是否正在防抖等待中
inherited
isMutexLocked(Object tag) bool
检查是否正在执行 mutex 任务
inherited
isThrottleLocked(Object tag) bool
检查是否处于节流冷却期
inherited
logE(String message, {LogExtra? logExtra, Object? error, StackTrace? stackTrace, DateTime? time, int? sequenceNumber, String? name, Zone? zone}) → void
for 'error'
inherited
logF(String message, {LogExtra? logExtra, Object? error, StackTrace? stackTrace, DateTime? time, int? sequenceNumber, String? name, Zone? zone}) → void
inherited
logger(String message, {LogExtra? logExtra, DateTime? time, int? sequenceNumber, int level = 800, String? name, Zone? zone, Object? error, StackTrace? stackTrace, bool uriFrame = true}) → dynamic
logExtra print stack frame info name logger.name null: will use 'runtimeType' stackTrace will print with red color by dev.log but if error == null: will ignore stackTrace
inherited
logI(String message, {LogExtra? logExtra, Object? error, StackTrace? stackTrace, DateTime? time, int? sequenceNumber, String? name, Zone? zone}) → void
inherited
logS(String message, {LogExtra? logExtra, Object? error, StackTrace? stackTrace, DateTime? time, int? sequenceNumber, String? name, Zone? zone}) → void
for debug 'shout'
inherited
logW(String message, {LogExtra? logExtra, Object? error, StackTrace? stackTrace, DateTime? time, int? sequenceNumber, String? name, Zone? zone}) → void
for 'warning'
inherited
mutex<R>(Object tag, FutureOr<R> action()) FutureOr<R?>
mutex 互斥锁 (Exhaust): 立即执行,执行期间的触发直接丢弃。
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ntfBy<T extends ChangeNotifier>(String tag) → T
inherited
on<E extends Event>(EventHandler<E, M> handler, {EventTransformer<E>? transformer}) → void
Register event handler for an event of type E. There should only ever be one event handler per event type E.
inherited
onChange(Change<M> change) → void
Called whenever a change occurs with the given change. A change occurs when a new state is emitted. onChange is called before the state of the cubit is updated. onChange is a great spot to add logging/analytics for a specific cubit.
inherited
onDone(E event, [Object? error, StackTrace? stackTrace]) → void
Called whenever an event handler for a specific Bloc has completed. This may include an error and stackTrace if an uncaught exception occurred within the event handler.
inherited
onError(Object error, StackTrace stackTrace) → void
Called whenever an error occurs and notifies BlocObserver.onError.
inherited
onEvent(E event) → void
Called whenever an event is added to the Bloc. A great spot to add logging/analytics at the individual Bloc level.
inherited
onTransition(Transition<E, M> transition) → void
Called whenever a transition occurs with the given transition. A transition occurs when a new event is added and a new state is emitted from a corresponding EventHandler.
inherited
put(M value) → M
Protected FlowR-style state mutation for subclasses.
inherited
putError(Object error, [StackTrace? stackTrace]) → void
Put error value to this bloc.
inherited
putWithLogging(M value, {OnLogging<M>? logging}) → M
inherited
runCatching<R>(FutureOr<R?> block(), {FutureOr<R?> onSuccess(R data)?, FutureOr<R?> onFailure(Object e, StackTrace s)?, bool ignoreSkipError = true, int slowlyMs = 0, Object? debounceTag, Object? throttleTag, Object? mutexTag}) FutureOr<R?>
run and catch error, then putError
inherited
skpIf(bool condition, String reason, {Level level = Level.FINE}) → void
if you want interrupt the normal flow, but not trigger runCatching.onFailure
inherited
skpIfNull(Object? obj, String reason) → void
if obj ==null, throw SkipError ref skpIf
inherited
skpNull<T>(T? obj, String reason, {Level level = Level.FINE}) → T
if obj == null: throw SkipError else: return obj!
inherited
subBy<T extends StreamSubscription>(String tag) → T
inherited
throttle<R>(Object tag, Duration duration, FutureOr<R> action(), {bool ensureLast = false}) FutureOr<R?>
throttle 节流: 固定频率执行。 配合 mutex 解决异步任务重叠问题:如果周期到了但上次任务还没跑完,直接跳过。 ensureLast: 如果为 true,则在节流期间的最后一次触发将被防抖补发。
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
override
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited