Files
deflock-app/lib/models/pending_upload.dart
T

33 lines
780 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:latlong2/latlong.dart';
import 'camera_profile.dart';
class PendingUpload {
final LatLng coord;
final double direction;
final CameraProfile profile;
int attempts;
PendingUpload({
required this.coord,
required this.direction,
required this.profile,
this.attempts = 0,
});
Map<String, dynamic> toJson() => {
'lat': coord.latitude,
'lon': coord.longitude,
'dir': direction,
'profile': profile.name,
'attempts': attempts,
};
factory PendingUpload.fromJson(Map<String, dynamic> j) => PendingUpload(
coord: LatLng(j['lat'], j['lon']),
direction: j['dir'],
profile: CameraProfile.alpr(), // only builtin for now
attempts: j['attempts'] ?? 0,
);
}