Open
Description
I have a Flutter app with Supabase backend. when I want to read data from tables for the first 3 times calling the database it's all good working but after 3 times I am facing this error :
PostgrestException(message: JWT expired, code: PGRST301, details: Unauthorized, hint: null)
the way I implement reading data is
Future<List<BrandModel>> getBrands() async {
List<BrandModel> data = [];
try {
var response = await supabase.from('brand').select();
data = (response as List).map((e) => BrandModel.fromJson(e)).toList();
} catch (e) {
print(e);
}
return data;
}
the main function is :
Future<void> main() async {
//? widget bindings
WidgetsFlutterBinding.ensureInitialized();
//? initializing supa
await Supabase.initialize(
url: AppConsts.supaBaseURL, anonKey: AppConsts.anonKey);
}