SerializableSyncAdapter<M, D> class
abstract
Abstract base class for a synchronization adapter with serialization capabilities.
This class extends SyncAdapter and adds functionality for serializing and deserializing metadata objects to and from JSON strings. It is generic over:
M: The type representing synchronization metadata.D: The type representing the detailed data associated with the metadata.
This class is particularly useful in scenarios where metadata needs to be stored or transmitted in a serialized format, such as in databases or over a network. It provides a foundation for implementing adapters that handle serialization seamlessly.
- Inheritance
-
- Object
- SyncAdapter<
M, D> - SerializableSyncAdapter
Constructors
-
SerializableSyncAdapter({required String getMetadataId(M metadata), required String metadataToJson(M metadata), required M metadataFromJson(String json), required FutureOr<
bool> isCurrentMetadataBeforeOther(M current, M other)}) -
Constructs a SerializableSyncAdapter with the required serialization functions.
const
Properties
- getMetadataId → String Function(M metadata)
-
A function that retrieves the unique identifier for the given
metadata.finalinherited - hashCode → int
-
The hash code for this object.
no setterinherited
-
isCurrentMetadataBeforeOther
→ FutureOr<
bool> Function(M current, M other) -
Determines if the
currentmetadata item is older than theothermetadata item.finalinherited - metadataFromJson → M Function(String json)
-
A function that deserializes a JSON string back into metadata of type
M.final - metadataToJson → String Function(M metadata)
-
A function that serializes metadata of type
Minto a JSON string.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
fetchDetail(
M metadata) → FutureOr< D> -
Retrieves the detailed data associated with the given
metadata.inherited -
fetchMetadataList(
) → FutureOr< List< M> > -
Fetches a list of metadata items available for synchronization.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
save(
M metadata, D? detail) → FutureOr< void> -
Saves the provided
metadataand its associateddetailto the data source.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited