Skip to content

Instantly share code, notes, and snippets.

@shubie
Last active April 18, 2019 19:31
Show Gist options
  • Save shubie/5e2fab24542a7bb4ce48f5a2db4afb77 to your computer and use it in GitHub Desktop.
Save shubie/5e2fab24542a7bb4ce48f5a2db4afb77 to your computer and use it in GitHub Desktop.
import 'package:states_lga/state_model.dart';
class Repository {
List<Map> getAll() => _nigeria;
getLocalByState(String state) => _nigeria
.map((map) => StateModel.fromJson(map))
.where((item) => item.state == state)
.map((item) => item.lgas)
.expand((i) => i)
.toList();
List<String> getStates() => _nigeria
.map((map) => StateModel.fromJson(map))
.map((item) => item.state)
.toList();
List _nigeria = [
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment