20 lines
604 B
Dart
20 lines
604 B
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
// Default sensor IDs for the 6 dashboard tile slots
|
|
const _defaultSlots = ['vss', 'map', 'tps', 'ect', 'iat', 'bat'];
|
|
|
|
class DashboardSlotsNotifier extends StateNotifier<List<String>> {
|
|
DashboardSlotsNotifier() : super(List.from(_defaultSlots));
|
|
|
|
void setSlot(int index, String sensorId) {
|
|
final next = List<String>.from(state);
|
|
next[index] = sensorId;
|
|
state = next;
|
|
}
|
|
}
|
|
|
|
final dashboardSlotsProvider =
|
|
StateNotifierProvider<DashboardSlotsNotifier, List<String>>(
|
|
(ref) => DashboardSlotsNotifier(),
|
|
);
|