mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-03-25 13:20:24 +01:00
39 lines
957 B
Dart
39 lines
957 B
Dart
import 'package:latlong2/latlong.dart';
|
|
import 'camera_profile.dart';
|
|
|
|
class PendingUpload {
|
|
final LatLng coord;
|
|
final double direction;
|
|
final CameraProfile profile;
|
|
int attempts;
|
|
bool error;
|
|
|
|
PendingUpload({
|
|
required this.coord,
|
|
required this.direction,
|
|
required this.profile,
|
|
this.attempts = 0,
|
|
this.error = false,
|
|
});
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'lat': coord.latitude,
|
|
'lon': coord.longitude,
|
|
'dir': direction,
|
|
'profile': profile.toJson(),
|
|
'attempts': attempts,
|
|
'error': error,
|
|
};
|
|
|
|
factory PendingUpload.fromJson(Map<String, dynamic> j) => PendingUpload(
|
|
coord: LatLng(j['lat'], j['lon']),
|
|
direction: j['dir'],
|
|
profile: j['profile'] is Map<String, dynamic>
|
|
? CameraProfile.fromJson(j['profile'])
|
|
: CameraProfile.alpr(),
|
|
attempts: j['attempts'] ?? 0,
|
|
error: j['error'] ?? false,
|
|
);
|
|
}
|
|
|