h4-projekt-gruppe-0-sm/mobile/lib/repos/add_to_cart_state.dart

16 lines
375 B
Dart

import 'dart:async';
import 'package:flutter/material.dart';
class AddToCartStateRepo extends ChangeNotifier {
int currentAmount = 0;
Timer resetTimer = Timer(const Duration(), () {});
void notify(Duration displayDuration) {
resetTimer.cancel();
currentAmount++;
notifyListeners();
resetTimer = Timer(displayDuration, () => currentAmount = 0);
}
}