ContentUpdater class Content
Manages and applies updates for downloaded content in the content store.
A ContentUpdater represents a single update session created by the ContentStore. Use ContentStore.createContentUpdater to obtain an instance. The updater is responsible for starting or resuming the download of available updates, reporting progress and status changes via callbacks, and applying the downloaded update when ready.
The updater supports updating content types such as ContentType.roadMap, ContentType.viewStyleLowRes and ContentType.viewStyleHighRes. For road maps the SDK requires all local road map items to have the same version; partial updates of individual roadMap items with different versions are not supported.
Example
final (contentUpdater, code) = ContentStore.createContentUpdater(ContentType.roadMap);
if (code == GemError.success || code == GemError.exist) {
final ProgressListener? listener = contentUpdater.update(
true,
onStatusUpdated: (status) {
if (status == ContentUpdaterStatus.fullyReady || status == ContentUpdaterStatus.partiallyReady) {
if (contentUpdater.canApply) {
final applyErr = contentUpdater.apply();
print('Apply resolved with code ${applyErr.code}');
}
}
},
onProgressUpdated: (p) => print('Progress: $p/100'),
onComplete: (err) => print('Update finished: $err'),
);
}
See also:
- ContentStore.createContentUpdater - Obtain a ContentUpdater instance.
- ContentUpdater.update - Start or resume the update process and register callbacks.
- ContentUpdater.apply - Apply a downloaded update when ready.
Properties
- canApply → bool
-
Checks if the content update can be applied.
no setter
- contentType → ContentType
-
Gets the content type being updated.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isStarted → bool
-
Checks if the content updater has started.
no setter
-
items
→ List<
ContentStoreItem> -
Gets the list of content items involved in the update process.
no setter
- mapId → int
-
no setter
- pointerId → int
-
The pointer ID of the native object
no setterinherited
- progress → int
-
Gets the progress value of the update operation.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → ContentUpdaterStatus
-
Gets the current status of the update operation.
no setter
Methods
-
apply(
) → GemError - Applies the content update.
-
cancel(
) → void - Cancels the content update operation.
-
dispose(
) → void -
Disposes the native object.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerAutoReleaseObject(
int pointerId) → void -
Registers an object for auto release.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
bool allowChargeNetwork, {void onStatusUpdated(ContentUpdaterStatus status)?, void onProgressUpdated(int progress)?, void onComplete(GemError error)?}) → ProgressListener? - Starts or resumes the content update process.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited