Address.fromNative constructor

Address.fromNative(
  1. Map<Object?, Object?> data
)

Creates a new Address instance from a map.

Implementation

factory Address.fromNative(Map<Object?, Object?> data) {
  final List<Object?>? addressLines = data['addressLines'] as List<Object?>?;
  final AddressType type = AddressType.fromRawValue(
    data['type'] as int? ?? 0,
  );

  if (addressLines == null) {
    return Address(type: type);
  }

  return Address(
    addressLines: List.unmodifiable(addressLines.cast<String>()),
    type: type,
  );
}