InappifyAppVersionInfo.fromMap constructor

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

Implementation

factory InappifyAppVersionInfo.fromMap(Map<String, dynamic> map) {
  final rawCode = map['versionCode'];
  final versionCode = rawCode is num
      ? rawCode.toInt()
      : int.tryParse(rawCode?.toString() ?? '');

  if (versionCode == null) {
    throw const FormatException('versionCode must be numeric.');
  }

  return InappifyAppVersionInfo(
    versionName: map['versionName']?.toString() ?? '',
    versionCode: versionCode,
  );
}