Skip to content

Instantly share code, notes, and snippets.

@alperefesahin
Created April 21, 2023 22:55
Show Gist options
  • Save alperefesahin/1efd9ea6328f50171b87bdfb08e5de91 to your computer and use it in GitHub Desktop.
Save alperefesahin/1efd9ea6328f50171b87bdfb08e5de91 to your computer and use it in GitHub Desktop.
class ExampleState extends Equatable {
const ExampleState({
this.user = const User(),
this.isLoading = false,
});
@override
List<Object?> get props => [
user,
isLoading,
];
final User userGratitude;
final bool isLoading;
bool get isAddButtonEnabled =>
user != const User() &&
user.name.length >= 3 &&
user.surname.length >= 10;
ExampleState copyWith({
User? user,
bool? isLoading,
}) {
return ExampleState(
user: user ?? this.user,
isLoading: isLoading ?? this.isLoading,
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment