Skip to content

Instantly share code, notes, and snippets.

@FlutterWiz
Created June 18, 2022 12:05
Show Gist options
  • Save FlutterWiz/8a5b0e7143687dcd844e0f6a96bbdeb7 to your computer and use it in GitHub Desktop.
Save FlutterWiz/8a5b0e7143687dcd844e0f6a96bbdeb7 to your computer and use it in GitHub Desktop.
final charactersDatasProvider = FutureProvider.autoDispose<List<CharacterModel>>(
(ref) {
return ref.read(apiProvider).getCharactersDatas().then(
(characters) {
final List<CharacterModel> characterList = [];
for (var i = 0; i < 10; i++) {
characterList.add(
CharacterModel(
characterName: characters[i]["name"],
characterImgUrl: characters[i]["image"],
),
);
}
return characterList;
},
);
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment