SyncBodyContext.fromMap constructor

SyncBodyContext.fromMap(
  1. Map<String, Object?> map
)

Creates a SyncBodyContext from a map.

Implementation

factory SyncBodyContext.fromMap(Map<String, Object?> map) {
  final raw = map['locations'];
  final locations = <Map<String, Object?>>[];
  if (raw is List) {
    for (final item in raw) {
      if (item is Map) {
        locations.add(Map<String, Object?>.from(item));
      }
    }
  }
  return SyncBodyContext(locations: locations);
}