on each request to AWS to put in the header.
But if the idToken is good for 60 minutes, I only want to call UserService.init() every 50 or 55 minutes or so to save time making requests (maybe multiple requests to different endpoints in a short span so don't want to call UserSerivce.init() each time) and to load pages faster on Flutter Web.
Is it advisable to use a timer in Dart to do this?
I am using your example code's
UserService
and store the tokens in local storage.I am refactoring code that does this:
on each request to AWS to put in the header.
But if the idToken is good for 60 minutes, I only want to call UserService.init() every 50 or 55 minutes or so to save time making requests (maybe multiple requests to different endpoints in a short span so don't want to call UserSerivce.init() each time) and to load pages faster on Flutter Web. Is it advisable to use a timer in Dart to do this?