import 'dart:typed_data'; import '../Utils/keys.dart'; class Unit { int id; String rangka; String mesin; String kode; String tahun; String tipe; String warna; String state; String flag; String timestamp; String channel; Unit({ required this.id, required this.rangka, required this.mesin, this.kode = '', this.tahun = '', this.tipe = '', this.warna = '', this.state = '', this.flag = '', this.timestamp = '', this.channel = '', }); factory Unit.fromJson(Map json) { return Unit( id: json[Columns.id], rangka: json[Columns.rangka], mesin: json[Columns.mesin], kode: json[Columns.kode], tahun: json[Columns.tahun], tipe: json[Columns.tipe], warna : json[Columns.warna], state: json[Columns.state], flag: json[Columns.flag], timestamp: json[Columns.timestamp]??'', channel: json[Columns.channel], );} Map toJson() => { Columns.id: id, Columns.rangka: rangka.toUpperCase(), Columns.mesin : mesin.toUpperCase(), Columns.kode : kode.toUpperCase(), Columns.tahun : tahun, Columns.tipe: tipe, Columns.warna: warna, Columns.state :state, Columns.flag :flag, Columns.timestamp :timestamp, Columns.channel:channel, }; } class Blob { int id; Uint8List? bytes; String mesin; String? lat; String? long; String jenis; String noUrut; Blob({ required this.id, required this.bytes, required this.mesin, required this.lat, required this.long, required this.jenis, required this.noUrut }); Map toJson() => { Columns.blobId: id, Columns.bytes : bytes, Columns.mesin : mesin, Columns.lat : lat, Columns.long : long, Columns.jenis : jenis, Columns.noUrut : noUrut }; factory Blob.fromJson(Map json) { return Blob( id: json[Columns.blobId], bytes: json[Columns.bytes], mesin: json[Columns.mesin], lat: json[Columns.lat], long: json[Columns.long], jenis: json[Columns.jenis], noUrut: json[Columns.noUrut] ); } } class Value { String name; String value; Value({ required this.name, required this.value }); Map toJson() => { Columns.name : name, Columns.value : value, }; factory Value.fromJson(Map json) => Value( name: json[Columns.name], value: json[Columns.value], ); } class ImageType { String value; String noUrut; ImageType({ required this.value, required this.noUrut }); Map toJson() => { Columns.value : value, Columns.noUrut : noUrut }; factory ImageType.fromJson(Map json) => ImageType( value: json[Columns.value], noUrut: json[Columns.noUrut] ); } class Count { int count; Count({ required this.count, }); factory Count.fromJson(Map json) => Count( count: json["count"], ); }