Skip to content

Instantly share code, notes, and snippets.

@jesusrp98
Created January 9, 2019 19:21
Show Gist options
  • Save jesusrp98/7ea784536f7551af19ecb5b903426d0d to your computer and use it in GitHub Desktop.
Save jesusrp98/7ea784536f7551af19ecb5b903426d0d to your computer and use it in GitHub Desktop.
Launchpad model using ScopedModel
class LaunchpadModel extends QuerryModel {
final String id, name;
LaunchpadModel(this.id, this.name);
@override
Future loadData() async {
// Get item by http call
response = await http.get(Url.launchpadDialog + id);
// Clear old data
clearItems();
// Add parsed item
items.add(Launchpad.fromJson(json.decode(response.body)));
// Finished loading data
setLoading(false);
}
Launchpad get launchpad => items[0];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment