summaryrefslogtreecommitdiffstats
path: root/lib/provider.dart
diff options
context:
space:
mode:
Diffstat (limited to 'lib/provider.dart')
-rw-r--r--lib/provider.dart28
1 files changed, 5 insertions, 23 deletions
diff --git a/lib/provider.dart b/lib/provider.dart
index 4c9ed0a..463e743 100644
--- a/lib/provider.dart
+++ b/lib/provider.dart
@@ -5,37 +5,19 @@ import 'dart:math';
import 'package:flutter_riverpod/flutter_riverpod.dart';
-final fuelProvider = StateNotifierProvider<fuel,double>((ref) =>
- fuel(),
+final fuelProvider = StateNotifierProvider<fuel, double>(
+ (ref) => fuel(),
);
-class fuel extends StateNotifier<double>{
+class fuel extends StateNotifier<double> {
late Timer timer;
- fuel() : super(0.2){
-
+ fuel() : super(0.2) {
Timer.periodic(Duration(seconds: 5), (timer) {
double num = Random().nextInt(100).toDouble();
update(num);
});
}
- void update(value){
- state = value;
- }
-}
-
-final DateTimeProvider = StateNotifierProvider<datetime,DateTime>((ref) =>
- datetime(),
-);
-
-class datetime extends StateNotifier<DateTime>{
- datetime() : super(DateTime.now()){
-
- Timer.periodic(Duration(seconds: 30), (timer) {
- DateTime _now = DateTime.now();
- update(_now);
- });
- }
- void update(value){
+ void update(value) {
state = value;
}
}