Module class abstract

A Module encapsulates a well-scoped logical unit of functionality and exposes a discrete public interface for consumers. It extends LifecycleModule to ensure that it adheres to a well-defined lifecycle.

The public interface of a Module is comprised of api, events, and components:

  • The api class exposes public methods that can be used to mutate or query module data.
  • The events class exposes streams that can be listened to for notification of internal module state change.
  • The components class exposes react-dart compatible UI components that can be used to render module data.
Inheritance

Constructors

Module()

Properties

activeSpan → Span?
If this module is in a transition state, this is the Span capturing the transition state.
no setterinherited
api → Object?
The api object should contain all public methods that a consumer can use to mutate module state (methods) or query existing module state (getters).
no setterinherited
childModules → Iterable<LifecycleModule>
List of child components so that lifecycle can iterate over them as needed
no setterinherited
components → ModuleComponents?
The components object should contain all react-dart compatible UI component factory methods that a consumer can use to render module data.
no setterinherited
didDispose → Future<Null>
A Future that will complete when this object has been disposed.
no setterinherited
didLoad → Stream<LifecycleModule>
The LifecycleModule was loaded.
no setterinherited
didLoadChildModule → Stream<LifecycleModule>
A child LifecycleModule was loaded.
no setterinherited
didResume → Stream<LifecycleModule>
The LifecycleModule was resumed.
no setterinherited
didSuspend → Stream<LifecycleModule>
The LifecycleModule was suspended.
no setterinherited
didUnload → Stream<LifecycleModule>
The LifecycleModule was unloaded.
no setterinherited
didUnloadChildModule → Stream<LifecycleModule>
A child LifecycleModule was unloaded.
no setterinherited
disposableTypeName → String
A type name, similar to runtimeType but intended to work with minified code.
no setterinherited
disposalTreeSize → int
The total size of the disposal tree rooted at the current Disposable instance.
no setterinherited
events → Object?
The events object should contain all public streams that a consumer can listen to for notification of internal module state change.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
isDisposed → bool
Whether this object has been disposed.
no setterinherited
isInstantiated → bool
Whether the module is currently instantiated.
no setterinherited
isLeakFlagSet → bool
Whether the leak flag for this object has been set.
no setterinherited
isLoaded → bool
Whether the module is currently loaded.
no setterinherited
isLoading → bool
Whether the module is currently loading.
no setterinherited
isOrWillBeDisposed → bool
Whether the disposal of this object has been requested, is in progress, or is complete.
no setterinherited
isResuming → bool
Whether the module is currently resuming.
no setterinherited
isSuspended → bool
Whether the module is currently suspended.
no setterinherited
isSuspending → bool
Whether the module is currently suspending.
no setterinherited
isUnloaded → bool
Whether the module is currently unloaded.
no setterinherited
isUnloading → bool
Whether the module is currently unloading.
no setterinherited
name ↔ String
Name of the module for identification in exceptions and debug messages.
getter/setter pairinherited
parentContext ← SpanContext?
Provide a way for a module to update its children's parentContext that is compatible with mocking in 2.19.
no getterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
willLoad → Stream<LifecycleModule>
The LifecycleModule is about to be loaded.
no setterinherited
willLoadChildModule → Stream<LifecycleModule>
A child LifecycleModule is about to be loaded.
no setterinherited
willResume → Stream<LifecycleModule>
The LifecycleModule is about to be resumed.
no setterinherited
willSuspend → Stream<LifecycleModule>
The LifecycleModule is about to be suspended.
no setterinherited
willUnload → Stream<LifecycleModule>
The LifecycleModule is about to be unloaded.
no setterinherited
willUnloadChildModule → Stream<LifecycleModule>
A child LifecycleModule is about to be unloaded.
no setterinherited

Methods

awaitBeforeDispose<T>(Future<T> future) → Future<T>
Add future to a list of futures that will be awaited before the object is disposed.
inherited
dispose() → Future<Null>
Disposes this module and all its disposable dependencies.
inherited
flagLeak([String? description]) → void
Flag the object as having been disposed in a way that allows easier profiling.
inherited
getManagedDelayedFuture<T>(Duration duration, T callback()) → Future<T>
Creates a Future that will complete, with the value returned by callback, after the given amount of time has elapsed.
inherited
getManagedDisposer(Disposer disposer) → ManagedDisposer
Automatically handle arbitrary disposals using a callback.
inherited
getManagedPeriodicTimer(Duration duration, void callback(Timer timer)) → Timer
Creates a periodic Timer that will be cancelled if active upon disposal.
inherited
getManagedTimer(Duration duration, void callback()) → Timer
Creates a Timer instance that will be cancelled if active upon disposal.
inherited
listenToStream<T>(Stream<T> stream, void onData(T event), {Function? onError, void onDone()?, bool? cancelOnError}) → StreamSubscription<T>
Returns a StreamSubscription which handles events from the stream using the provided onData, onError and onDone handlers.
inherited
load() → Future<Null>
Public method to trigger the loading of a Module.
inherited
loadChildModule(LifecycleModule? childModule) → Future<Null>
Public method to async load a child module and register it for lifecycle management.
inherited
manageAndReturnTypedDisposable<T extends Disposable>(T disposable) → T
Automatically dispose another object when this object is disposed.
inherited
manageCompleter<T>(Completer<T> completer) → Completer<T>
Ensure that a completer is completed when the object is disposed.
inherited
manageDisposable(Disposable disposable) → void
inherited
manageStreamController(StreamController controller) → void
Automatically cancel a stream controller when this object is disposed.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDidLoadChildModule(LifecycleModule module) → Future<Null>
Custom logic to be executed when a child module has been loaded.
inherited
onDidUnloadChildModule(LifecycleModule module) → Future<Null>
Custom logic to be executed when a child module has been unloaded.
inherited
onDispose() → Future<Null>
Callback to allow arbitrary cleanup on dispose.
inherited
onLoad() → Future
Custom logic to be executed during load.
inherited
onResume() → Future<void>
Custom logic to be executed during resume.
inherited
onShouldUnload() → ShouldUnloadResult
Custom logic to be executed during shouldUnload (consequently also in unload).
inherited
onSuspend() → Future<Null>
Custom logic to be executed during suspend.
inherited
onUnload() → Future<Null>
Custom logic to be executed during unload.
inherited
onWillDispose() → Future<Null>
Callback to allow arbitrary cleanup as soon as disposal is requested (i.e. dispose is called) but prior to disposal actually starting.
inherited
onWillLoadChildModule(LifecycleModule module) → Future<Null>
Custom logic to be executed when a child module is to be loaded.
inherited
onWillUnloadChildModule(LifecycleModule module) → Future<Null>
Custom logic to be executed when a child module is to be unloaded.
inherited
resume() → Future<Null>
Public method to resume the module.
inherited
shouldUnload() → ShouldUnloadResult
Public method to query the unloadable state of the Module.
inherited
specifyFirstUsefulState({Map<String, dynamic> tags = const {}, List<Reference> references = const []}) → void
Creates a span with globalTracer from the start of load until now.
inherited
specifyStartupTiming(StartupTimingType specifier, {Map<String, dynamic> tags = const {}, List<Reference> references = const []}) → void
Creates a span with globalTracer from the start of load until now.
inherited
suspend() → Future<Null>
Public method to suspend the module.
inherited
toString() → String
A string representation of this object.
inherited
unload() → Future<Null>
Public method to trigger the Module unload cycle.
inherited

Operators

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