SharedData<D, S> class

Class for shared data between AsyncTask instances.

This instance will be transferred to the executor thread/isolate only once, and not per task, avoiding the Isolate messaging bottle neck.

  • The internal data should NOT be modified after instantiated.
  • S should be a simple type that can be sent through threads/isolates or serialized as JSON.
  • The default implementation supports Dart basic types: primitive values (null, num, bool, double, String), lists and maps whose elements are any of these.
Available Extensions

Constructors

SharedData(D data, {S serializer(D data)?, SharedData<D, S> deserializer(S serial)?, String signatureComputer(D data)?, bool noSerializationOnDartNative = false})

Properties

allowCopyBySerialization bool
getter/setter pair
data → D
The actual data.
final
deserializer ↔ (SharedData<D, S> Function(S serial)?)
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
noSerializationOnDartNative bool
If true no serialization will be performed when transferring this data to another Isolate. A platform dependent object memory copy will be performed.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serializer ↔ (S Function(D data)?)
getter/setter pair
signature String
The signature of data, computed only once.
no setter
signatureComputer ↔ (String Function(D data)?)
getter/setter pair

Methods

cast<X, Y>() SharedData<X, Y>
Casts to SharedData<X, Y>.
computeSignature() String
The computation of signature.
copy() SharedData<D, S>
Creates a copy of this instance.
deserialize(S serial, {AsyncTaskPlatform? platform}) SharedData<D, S>
Deserialize a SharedData from serial.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Dispose any cached computation, like signature and serializeCached.
serialize({AsyncTaskPlatform? platform}) → S
Serializes this instance to S.
serializeCached({AsyncTaskPlatform? platform}) → S
Serializes this instances to S using a cache for recurrent calls.
toString() String
A string representation of this object.
inherited

Operators

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