resolve method
Future<DatumConflictResolution<T> >
resolve({
- T? local,
- T? remote,
- required DatumConflictContext context,
override
Resolves a conflict between a local and remote version of an entity.
Implementation
@override
Future<DatumConflictResolution<T>> resolve({
T? local,
T? remote,
required DatumConflictContext context,
}) async {
if (local == null && remote == null) {
return DatumConflictResolution.abort(
'No entities supplied to CRDT resolver.',
);
}
if (local == null || remote == null) {
return DatumConflictResolution.abort(
'CRDT merge requires both local and remote data to be available.',
);
}
final merged = local.merge(remote) as T;
return DatumConflictResolution.merge(merged);
}