fromJson static method

AttachRecord? fromJson(
  1. Map<String, Object?> j
)

Implementation

static AttachRecord? fromJson(Map<String, Object?> j) {
  final appKey = j['appKey'] as String?;
  final deviceId = j['deviceId'] as String?;
  final platform = j['platform'] as String?;
  if (appKey == null || deviceId == null || platform == null) return null;
  return AttachRecord(
    appKey: appKey,
    displayName: j['displayName'] as String?,
    bundleId: j['bundleId'] as String?,
    deviceId: deviceId,
    platform: platform,
    deviceName: j['deviceName'] as String?,
    osVersion: j['osVersion'] as String?,
    projectDir: j['projectDir'] as String?,
    firstSeen: DateTime.tryParse(j['firstSeen'] as String? ?? '') ?? DateTime.fromMillisecondsSinceEpoch(0),
    lastSeen: DateTime.tryParse(j['lastSeen'] as String? ?? '') ?? DateTime.fromMillisecondsSinceEpoch(0),
    attachCount: (j['attachCount'] as int?) ?? 1,
  );
}