Committed by
GitHub
Merge pull request #2520 from Andrflor/fix-status
Fixed generic type and equality assert
Showing
2 changed files
with
7 additions
and
6 deletions
@@ -247,11 +247,11 @@ typedef NotifierBuilder<T> = Widget Function(T state); | @@ -247,11 +247,11 @@ typedef NotifierBuilder<T> = Widget Function(T state); | ||
247 | 247 | ||
248 | abstract class GetStatus<T> with Equality { | 248 | abstract class GetStatus<T> with Equality { |
249 | const GetStatus(); | 249 | const GetStatus(); |
250 | - factory GetStatus.loading() => LoadingStatus(); | ||
251 | - factory GetStatus.error(String message) => ErrorStatus(message); | ||
252 | - factory GetStatus.empty() => EmptyStatus(); | ||
253 | - factory GetStatus.success(T data) => SuccessStatus(data); | ||
254 | - factory GetStatus.custom() => CustomStatus(); | 250 | + factory GetStatus.loading() => LoadingStatus<T>(); |
251 | + factory GetStatus.error(String message) => ErrorStatus<T, String>(message); | ||
252 | + factory GetStatus.empty() => EmptyStatus<T>(); | ||
253 | + factory GetStatus.success(T data) => SuccessStatus<T>(data); | ||
254 | + factory GetStatus.custom() => CustomStatus<T>(); | ||
255 | } | 255 | } |
256 | 256 | ||
257 | class CustomStatus<T> extends GetStatus<T> { | 257 | class CustomStatus<T> extends GetStatus<T> { |
@@ -8,7 +8,8 @@ mixin Equality { | @@ -8,7 +8,8 @@ mixin Equality { | ||
8 | @override | 8 | @override |
9 | bool operator ==(dynamic other) { | 9 | bool operator ==(dynamic other) { |
10 | return identical(this, other) || | 10 | return identical(this, other) || |
11 | - const DeepCollectionEquality().equals(props, other.props); | 11 | + runtimeType == other.runtimeType && |
12 | + const DeepCollectionEquality().equals(props, other.props); | ||
12 | } | 13 | } |
13 | 14 | ||
14 | @override | 15 | @override |
-
Please register or login to post a comment