manuelbosi
04/23/2022, 2:15 PMdart
void _setupInsertSubscription() async {
subscriptions['insert'] = _client.from(tableName).on(SupabaseEventTypes.insert, (payload) {
final newList = ListModel.fromJson(payload.newRecord);
lists = [newList, ...lists];
notifyListeners();
}).subscribe();
}
Vinzent
04/23/2022, 3:10 PMmanuelbosi
04/23/2022, 3:53 PMdart
void _setupInsertSubscription() {
subscriptions['insert'] =
_client.from(tableName).on(SupabaseEventTypes.insert, (payload) async {
final newList = ListModel.fromJson(payload.newRecord, false);
final int marketId = payload.newRecord!['market_id'];
final market = await _client
.from('sl_markets')
.select()
.eq('id', marketId)
.limit(1)
.single()
.execute();
newList.market = Market.fromJson(market.data);
lists = [newList, ...lists];
notifyListeners();
}).subscribe();
}
but on the callback with the "async" keyword returns me an unhandle exception "Concurrent modification during iteration", but without async i cannot await 😅AshwaqAzan
07/22/2022, 8:47 PM