init method
Initializes the client and its handlers.
This method must be called before making any requests. It initializes:
- The authentication handler (restores stored tokens)
- The cache handler (if caching is enabled)
If migrateFromHive is true (default), attempts to migrate tokens
from legacy Hive storage to the new storage format.
Returns this for method chaining.
Example:
final client = await RestApiClientImpl(options: options).init();
Implementation
@override
Future<RestApiClient> init([bool migrateFromHive = true]) async {
await authHandler.init(migrateFromHive);
if (_options.cacheEnabled) {
await cacheHandler.init();
}
return this;
}