Business Login Flutter Apps
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

160 righe
3.0 KiB

  1. import 'dart:typed_data';
  2. import '../Utils/keys.dart';
  3. class Unit {
  4. int id;
  5. String rangka;
  6. String mesin;
  7. String kode;
  8. String tahun;
  9. String tipe;
  10. String warna;
  11. String state;
  12. String flag;
  13. String timestamp;
  14. String channel;
  15. Unit({
  16. required this.id,
  17. required this.rangka,
  18. required this.mesin,
  19. this.kode = '',
  20. this.tahun = '',
  21. this.tipe = '',
  22. this.warna = '',
  23. this.state = '',
  24. this.flag = '',
  25. this.timestamp = '',
  26. this.channel = '',
  27. });
  28. factory Unit.fromJson(Map<String, dynamic> json) {
  29. return Unit(
  30. id: json[Columns.id],
  31. rangka: json[Columns.rangka],
  32. mesin: json[Columns.mesin],
  33. kode: json[Columns.kode],
  34. tahun: json[Columns.tahun],
  35. tipe: json[Columns.tipe],
  36. warna : json[Columns.warna],
  37. state: json[Columns.state],
  38. flag: json[Columns.flag],
  39. timestamp: json[Columns.timestamp]??'',
  40. channel: json[Columns.channel],
  41. );}
  42. Map<String, dynamic> toJson() => {
  43. Columns.id: id,
  44. Columns.rangka: rangka.toUpperCase(),
  45. Columns.mesin : mesin.toUpperCase(),
  46. Columns.kode : kode.toUpperCase(),
  47. Columns.tahun : tahun,
  48. Columns.tipe: tipe,
  49. Columns.warna: warna,
  50. Columns.state :state,
  51. Columns.flag :flag,
  52. Columns.timestamp :timestamp,
  53. Columns.channel:channel,
  54. };
  55. }
  56. class Blob {
  57. int id;
  58. Uint8List? bytes;
  59. String mesin;
  60. String? lat;
  61. String? long;
  62. String jenis;
  63. String noUrut;
  64. Blob({
  65. required this.id,
  66. required this.bytes,
  67. required this.mesin,
  68. required this.lat,
  69. required this.long,
  70. required this.jenis,
  71. required this.noUrut
  72. });
  73. Map<String, dynamic> toJson() => {
  74. Columns.blobId: id,
  75. Columns.bytes : bytes,
  76. Columns.mesin : mesin,
  77. Columns.lat : lat,
  78. Columns.long : long,
  79. Columns.jenis : jenis,
  80. Columns.noUrut : noUrut
  81. };
  82. factory Blob.fromJson(Map<String, dynamic> json) {
  83. return Blob(
  84. id: json[Columns.blobId],
  85. bytes: json[Columns.bytes],
  86. mesin: json[Columns.mesin],
  87. lat: json[Columns.lat],
  88. long: json[Columns.long],
  89. jenis: json[Columns.jenis],
  90. noUrut: json[Columns.noUrut]
  91. );
  92. }
  93. }
  94. class Value {
  95. String name;
  96. String value;
  97. Value({
  98. required this.name,
  99. required this.value
  100. });
  101. Map<String, dynamic> toJson() => {
  102. Columns.name : name,
  103. Columns.value : value,
  104. };
  105. factory Value.fromJson(Map<String, dynamic> json) => Value(
  106. name: json[Columns.name],
  107. value: json[Columns.value],
  108. );
  109. }
  110. class ImageType {
  111. String value;
  112. String noUrut;
  113. ImageType({
  114. required this.value,
  115. required this.noUrut
  116. });
  117. Map<String, dynamic> toJson() => {
  118. Columns.value : value,
  119. Columns.noUrut : noUrut
  120. };
  121. factory ImageType.fromJson(Map<String, dynamic> json) => ImageType(
  122. value: json[Columns.value],
  123. noUrut: json[Columns.noUrut]
  124. );
  125. }
  126. class Count {
  127. int count;
  128. Count({
  129. required this.count,
  130. });
  131. factory Count.fromJson(Map<String, dynamic> json) => Count(
  132. count: json["count"],
  133. );
  134. }