OTAProgress.fromMap constructor

OTAProgress.fromMap(
  1. Map<String, dynamic> map
)

Create from map received from platform channel

Implementation

factory OTAProgress.fromMap(Map<String, dynamic> map) {
  return OTAProgress(
    deviceAddress: map['deviceAddress'] as int,
    state: OTAState.fromString(map['state'] as String),
    progressPercent: map['progressPercent'] as int? ?? 0,
    bytesTransferred: map['bytesTransferred'] as int? ?? 0,
    totalBytes: map['totalBytes'] as int? ?? 0,
    error: map['error'] as String?,
    estimatedSecondsRemaining: map['estimatedSecondsRemaining'] as int?,
  );
}