Package selection guidance compiled from public package information, community data, and project usage.
Fresh GraphQL is a Flutter/Dart package that extends the functionality of the graphql package by providing an automatic token refresh mechanism for GraphQL requests. It seamlessly handles authentication tokens, ensuring they are refreshed before expired requests are sent. Built on top of the core graphql package, it simplifies secure API communication in apps requiring persistent authentication. Ideal for applications using JWT or similar token-based auth systems.
Use cases
Secure GraphQL API access with auto-refresh
Handling expired tokens without user intervention
Integrating with JWT-based authentication
Managing authenticated sessions across app restarts
Simplifying state management for auth tokens
Key features
Automatic token refresh
Transparent integration with graphql package
Support for custom token refresh logic
Built-in retry mechanism for failed requests
Cross-platform compatibility
Suitable for
Apps using JWT or OAuth2
Developers seeking seamless auth handling
Projects with frequent GraphQL calls
Teams prioritizing developer experience
Applications requiring robust session management
Considerations
Requires proper setup of token refresh endpoint
Depends on external auth service availability
May need customization for non-standard auth flows
Not suitable for stateless APIs without tokens
Limited to use with graphql package only
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
Fresh 🍋
A collection of packages for automatic token refresh in Dart and Flutter. Fresh handles refreshing, caching, and attaching authentication tokens transparently so your API calls just work.
Why Fresh?
Token-based authentication seems simple until you handle the edge cases: tokens expire mid-session, multiple requests fail at the same time triggering duplicate refreshes, refresh tokens get revoked, and you need to route users to login when auth is lost. Fresh handles all of this so you don't have to.
No more manual 401 handling scattered across your codebase
No more race conditions when concurrent requests trigger simultaneous refreshes
No more stale tokens causing request failures - expired tokens are refreshed proactively before the request is even sent