BleConnectionFailure.fromMap constructor
Creates a BleConnectionFailure from the map sent across the method channel by the native platform.
The map is tolerant of missing keys: any absent or malformed field falls back to null, and an absent or
unrecognized category falls back to BleConnectionFailureCategory.unknown (see
BleConnectionFailureCategory.fromIdentifier). This ensures a failure event can always be constructed even from a
partial payload.
- Parameter
map: The decoded method channel arguments describing the failure. - Returns: A BleConnectionFailure populated with whatever detail the platform provided.
Implementation
factory BleConnectionFailure.fromMap(Map<Object?, Object?> map) {
return BleConnectionFailure(
category: BleConnectionFailureCategory.fromIdentifier(
map['category'] as String?,
),
platform: map['platform'] as String?,
rawCode: map['errorCode'] as int?,
domain: map['errorDomain'] as String?,
description: map['errorDescription'] as String?,
);
}