Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. # sembast ## 단건 조회 ## 목록 조회 <code dart> Future<List<Section>> loadSectionList(Pantry pantry) async { final finder = Finder( filter: Filter.equals(Column.pantryKey, pantry.key), sortOrders: [ SortOrder(Column.order), ], ); var recordSnapshots = await _store.find(await _db, finder: finder); return recordSnapshots.map((snapshot) { var section = Section.fromJson(snapshot.value); section = section.copyWith(key: snapshot.key); return section; }).toList(); } </code> <code dart> Future<List<Fruit>> getAllStoredByName() async { final finder = Finder(sortOrders: [ SortOrder('name'), ]); final recordSnapshots = await _fruitStore.find( await _db, finder: finder, ); // Making a List<Fruit> out of List<RecordSnapshot> return recordSnapshots.map((snapshot) { final fruit = Fruit.fromMap(snapshot.value); // An ID is a key of a record from the database. fruit.id = snapshot.key; return fruit; }).toList(); } </code> open/sembast.txt Last modified: 2024/10/05 06:15by 127.0.0.1