summaryrefslogtreecommitdiffstats
path: root/lib/kuksa/class-provider.dart
blob: 1169f6c7dc5a519517bcfde1d788166f49e864b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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,
    );
  }
}