Last active
January 29, 2020 09:38
-
-
Save bardiarastin/3997adb995e3bbb4f7eeb7f6f445af86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:meta/meta.dart'; | |
import 'package:redux_example/src/models/i_post.dart'; | |
@immutable | |
class PostsState { | |
final bool isError; | |
final bool isLoading; | |
final List<IPost> posts; | |
PostsState({ | |
this.isError, | |
this.isLoading, | |
this.posts, | |
}); | |
factory PostsState.initial() => PostsState( | |
isLoading: false, | |
isError: false, | |
posts: const [], | |
); | |
PostsState copyWith({ | |
@required bool isError, | |
@required bool isLoading, | |
@required List<IPost> posts, | |
}) { | |
return PostsState( | |
isError: isError ?? this.isError, | |
isLoading: isLoading ?? this.isLoading, | |
posts: posts ?? this.posts, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment