Andreas Fahrecker 88a9026966 Added isLoading bool and changed timer to a List of Timer called timers
Signed-off-by: Andreas Fahrecker <AndreasFahrecker@gmail.com>
2020-10-13 15:02:29 +02:00

36 lines
742 B
Dart

import 'package:meta/meta.dart';
import 'package:time_progress_calculator/models/timer.dart';
@immutable
class AppState {
final bool isLoading;
final List<Timer> timers;
AppState({
this.isLoading = false,
this.timers = const [],
});
factory AppState.initial() => AppState(isLoading: true);
AppState copyWith({
bool isLoading,
List<Timer> timers,
}) {
return AppState(
isLoading: isLoading ?? this.isLoading,
timers: timers ?? this.timers,
);
}
@override
int get hashCode => timers.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is AppState &&
runtimeType == other.runtimeType &&
timers == other.timers;
}