Flutter
App Binding
Background lifecycle integration, planned but not yet implemented.
AuthyraAppBinding is a placeholder in the current source, a WidgetsBindingObserver that would pause the background refresh timer while the app is backgrounded and resume it on foreground. It is not implemented yet: there's no such class to import today.Current behaviour
When AuthConfig.autoRefresh: true (the default), SessionManager's background TokenRefresher runs on a periodic timer regardless of whether the app is foregrounded or backgrounded. This is rarely a practical problem, the check interval is coarse (default: once a minute) and only does work when a token is actually close to expiring, but it does mean the timer keeps firing while your app is backgrounded rather than pausing.
Your options today
- Leave it as is. For most apps the background cost is negligible.
- Disable
autoRefreshentirely (AuthConfig(autoRefresh: false)) and callrefreshSession()manually wherever fits your app (e.g. on resume, or right before a request that needs a fresh token). This trades convenience for full control, not just pausing while backgrounded.
There is currently no public API to pause and resume the background timer around app lifecycle transitions without disabling autoRefresh altogether.