Files
flutter_wisetronic/lib/store/state/app_state.dart
2020-12-23 00:43:59 -05:00

42 lines
919 B
Dart

import 'package:flutter/material.dart';
import 'package:flutter_wisetronic/models/user.dart';
@immutable
class AppState {
final BuildContext context;
final Locale locale;
final User user;
AppState({this.context, this.locale, this.user});
factory AppState.init() => AppState();
AppState copyWith({
BuildContext context,
Locale locale}) {
return AppState(
context: context ?? this.context,
locale: locale ?? this.locale,
user: user ?? this.user,
);
}
@override
int get hashCode =>
context.hashCode ^
locale.hashCode ^
user.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is AppState &&
context == other.context &&
locale == other.locale &&
user == other.user;
@override
String toString() =>
'AppState(context: $context, locale: $locale), user: $user';
}