summaryrefslogtreecommitdiffstats
path: root/lib/kuksa/class-provider.dart
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kuksa/class-provider.dart')
-rw-r--r--lib/kuksa/class-provider.dart39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/kuksa/class-provider.dart b/lib/kuksa/class-provider.dart
new file mode 100644
index 0000000..1169f6c
--- /dev/null
+++ b/lib/kuksa/class-provider.dart
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: Apache-2.0
+
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+
+import 'class.dart';
+
+final vehicleSignalProvider =
+StateNotifierProvider<VehicleSignalNotifier, VehicleSignal>(
+ (ref) => VehicleSignalNotifier(),
+);
+
+class VehicleSignalNotifier extends StateNotifier<VehicleSignal> {
+ VehicleSignalNotifier() : super(_initialValue);
+ static final VehicleSignal _initialValue = VehicleSignal(
+
+ currentLatitude: 31.706964,
+ currentLongitude: 76.933138,
+
+ destinationLatitude: 0,
+ destinationLongitude: 0,
+ );
+ void update({
+
+ double? currentLatitude,
+ double? currentLongitude,
+
+ double? destinationLatitude,
+ double? destinationLongitude,
+ }) {
+ state = state.copyWith(
+
+ currentLatitude: currentLatitude,
+ currentLongitude: currentLongitude,
+
+ destinationLatitude: destinationLatitude,
+ destinationLongitude: destinationLongitude,
+ );
+ }
+} \ No newline at end of file