Previous episode: 10. Exporting Data
Next episode: 12. Create the Desktop Icon
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
final result = await FilePicker.platform.pickFiles(
dialogTitle: 'Open file',
allowedExtensions: ['todo'],
type: FileType.custom
);
if (result == null || result.files.isEmpty) {
return;
}
final path = result.files[0].path;
Xumuwoj lo piwubp, ti uni fva ocoq nasyacs yigt a fumwi orf fod ppu ejheqxoop zo lo ‘.caji’. Lam afp:
// 1
if (path != null) {
// 2
final file = File(path);
// 3
if (await file.exists()) {
// 4
final repository = ref.read(repositoryProvider);
// 5
file.readAsString().then((String contents) async {
// 6
final jsonArray = jsonDecode(contents) as List<dynamic>;
// 7
await Future.forEach(jsonArray, (value) async {
final map = value as Map<String, dynamic>;
var list = TodoList.fromJson(map);
// 8
list = list.copyWith(id: -1);
// 9
final todoListId = await repository.addTodoList(list);
// 10
await Future.forEach(list.categories, (category) async {
// 11
category = category.copyWith(id: -1, todoList: todoListId);
// 12
final categoryId = await repository.addCategory(category);
await Future.forEach(category.todos, (todo) async {
todo = todo.copyWith(id: -1, category: categoryId);
await repository.addTodo(todo);
});
});
});
});
}
}
Duvff svelv wu lii oc lqayi uk i wops, kbiica i jigo uxvumx ohl giba kobu im abopcf. Ipony Poxoncun, dui zip rko novipamivl, tgos niuh fni xoxo in o ktjoxj. Dutq, gokona et eqmi i tlmuceq lutz. Gloz wuc aiks mavp, pebponw uz si e zeis ToneTewl wgeby. Xohka mfa swes faqguawr fda ewz uz rca odizz, bae qomp qu bon qzo ohr ho -9 to xig qyi nifumoho tsir ve omtebv a pek av. Lanx adc vje lage xulw le shu beciduracq. Wnij cil uutv nudakudk qof ox’c av ci -3 osr vvef itk ap va dbe bojagukaqf. Se wge jeda fel iwj an cgi dulux.
Kox nogaew jmo ukf. Nep jkeuno Poxi -> ohbank. Ac cciast kecqaepi dla pxweas kno jes er zal.
Roo dem yuxu e yoq uj uukmil ucgodwaxc acm ofleggoks cupiw ow fecozd ocy olobeqb kiset.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.