DeviceInfo.fromJson constructor

DeviceInfo.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory DeviceInfo.fromJson(Map<String, dynamic> json) {
  return DeviceInfo(
    id: json['id'] ?? '',
    os: json['os'] ?? '',
    osVersion: json['osVersion'] ?? '',
    terminalTimeZone: json['terminalTimeZone'] ?? '',
    secure: json['secure'] ?? false,
    lastPingTime: DateTime.parse(
        json['lastPingTime'] ?? DateTime.now().toIso8601String()),
    latitude: (json['latitude'] ?? 0).toDouble(),
    longitude: (json['longitude'] ?? 0).toDouble(),
    data: Map<String, String>.from(json['data'] ?? {}),
  );
}