admin管理员组文章数量:1287858
I have a states
db and a cities
table in my Supabase db. The relationship between them is as you would expect - state_id
in the cities
db is mapped to states.id
as a foreign key. So one state can have multiple cities, and each city has to have a parent state.
I am using this code to get the stream:
static final streamProvider =
StreamProvider.autoDispose.family<List<City>, int>(
(ref, stateId) {
var streamBuilder = supabase
.from('cities')
.stream(primaryKey: ['id']).eq('state_id', stateId);
var stream = streamBuilder
.map((data) => data.map((json) => City.fromMap(json)).toList());
return stream;
},
);
I am using this in my ConsumerState
widget using:
final citiesAsync = ref.watch(SupabaseDB.streamProvider(_parentState.id));
I have enabled realtime on the cities
table and on the states
table on the Supabase dashboard.
This code works fine when a new city is created or an existing city updated - I get the changes reflected on the respective ConsumerState widget right away. However, deleting cities does not reflect in my widget.
What am I missing?
本文标签: Delete events not captured by Riverpod streamprovider family with SupabaseStack Overflow
版权声明:本文标题:Delete events not captured by Riverpod streamprovider family with Supabase - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741326369a2372504.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论