KRestApiBase class abstract

================================================= ApiBase

Base class for the top-level API container in this package.

Extend this class once per app-level API root and let that object own the concrete API clients for the app, such as ChatsApi and UsersApi. Shared configuration such as API keys, monitoring, and cache setup lives here.

Create the child API objects after the ApiBase instance exists, either in the constructor body or through a lazy getter / late final field.

Example:

class MainApi extends kickin.ApiBase {
  static final on = MainApi._();
  MainApi._();

  late final ChatsApi chats = ChatsApi(this);
  late final UsersApi users = UsersApi(this);
}

Use a single shared instance for each API root to avoid cache or state conflicts between clients. Use only one instance of this class per API root to avoid cache conflicts. For example, if you have a MainApi class that extends KApiBase, create a single instance of MainApi and use it throughout your app.

Constructors

KRestApiBase()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

intialize({String? baseUrl, bool monitorActivities = kDebugMode, String cacheBoxName = kApiCacheBoxName, bool syncCacheToStorage = false, LogOptions logOptions = const LogOptions()}) Future<void>
withApiKeys: A map of API keys to be registered. The keys should implement the ApiKeyEnum interface. Remember to register keys for all APIs you intend to use in the system.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setExternal(Dio dio) → void
Replaces the external Dio instance used by requests that opt out of the primary client.
setPrimaryDio(Dio dio) → void
Replaces the primary Dio instance used by requests that opt into it.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited