Last active
May 18, 2021 14:22
-
-
Save jacobaraujo7/2d41d0ac18f9051a779135f7f7e68238 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//avaliable in Dart 2.13 | |
typedef ProductList = List<Product>; | |
class ProductStore extends StreamStore<Exception, ProductList> { | |
final ProductRepository repository; | |
Counter({required this.repository}): super([]); | |
fetchProduct() async { | |
setLoading(true); | |
try { | |
final list = await repository.fetchAllProducts(); | |
update(list); | |
} on Exception catch (e) { | |
setError(e); | |
} finally { | |
setLoading(false); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dear @jacobaraujo7, the constructor name in the line 8 is incorrect (it should be ProductStore), right?