File tree Expand file tree Collapse file tree 4 files changed +11
-15
lines changed Expand file tree Collapse file tree 4 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -17,12 +17,14 @@ class InformationBloc {
1717 Stream <PackageInfo > get infoStream => _infoStream;
1818 Stream <GithubReleaseModel > get releases => _releases;
1919
20- // BLoc that serves connectivity information and package information to the information drawer.
20+ // BLoc that serves package information to the information drawer.
2121 InformationBloc (this .packageInfo, this .api) {
2222 _infoStream = Observable .fromFuture (packageInfo).asBroadcastStream ();
2323
24+ api.getReleases ();
25+
2426 _releases = Observable .fromFuture (api.getReleases ())
25- .debounce (Duration (minutes : 5 ))
27+ .debounce (Duration (seconds : 1 ))
2628 .asBroadcastStream ();
2729 }
2830}
Original file line number Diff line number Diff line change @@ -35,10 +35,8 @@ class ListPage extends StatelessWidget {
3535 );
3636 }
3737
38- infoBloc.releases.listen ((releases) {
39- infoBloc.infoStream.listen ((pkInfo) {
40- print (pkInfo.version);
41- print (releases.tagName);
38+ infoBloc.infoStream.listen ((pkInfo) {
39+ infoBloc.releases.listen ((releases) {
4240 if (pkInfo.version.toString () != releases.tagName) {
4341 showDialog (
4442 context: context,
Original file line number Diff line number Diff line change @@ -13,13 +13,9 @@ class GithubApi {
1313 Future <GithubReleaseModel > getReleases () async {
1414 List <GithubReleaseModel > items = [];
1515
16- await _client
17- .get (Uri .parse (_url))
18- .then ((Response res) => res.body)
19- .then (json.decode)
20- .then ((j) => j.forEach ((Map <String , dynamic > contribution) =>
21- items.add (GithubReleaseModel .fromJson (contribution))));
22-
23- return items.first;
16+ Response res = await _client.get (Uri .parse (_url));
17+ List map = json.decode (res.body);
18+ var x = map.map ((gh) => GithubReleaseModel .fromJson (gh)).toList ();
19+ return x.first;
2420 }
2521}
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ class GithubReleaseModel {
5757
5858 GithubReleaseModel (this .tagName, this .htmlUrl);
5959
60- GithubReleaseModel .fromJson (Map < String , dynamic > json)
60+ GithubReleaseModel .fromJson (Map json)
6161 : this .tagName = json['tag_name' ],
6262 this .htmlUrl = json['html_url' ];
6363}
You can’t perform that action at this time.
0 commit comments