CkAuthService<TProfile> class

Main orchestrator — singleton, initialized automatically by CoreKit when CkAuthConfig is provided.

Properties

authState CkAuthStateController
final
availableCkSocialProviders List<CkSocialProvider>
Available social providers
no setter
config CkAuthConfig<TProfile>
final
currentProfile → TProfile?
no setter
hashCode int
The hash code for this object.
no setterinherited
isAuthenticated bool
no setter
loadingController CkAuthLoadingController
final
logoutHandler CkLogoutHandler
final
otpManager CkOtpFlowManager
final
profileStream Stream<TProfile?>
Stream of user profile changes.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
socialManager CkSocialAuthManager<TProfile>
final
tokenManager CkAuthTokenManager
final

Methods

autoNavigate() Future<void>
fetchProfile() Future<CkAuthResult<TProfile?>>
Fetches the profile from the server using the configured getProfile endpoint.
forgotPassword({required Map<String, dynamic> body, Map<String, String>? headers}) Future<CkAuthResult<void>>
Forgot password — auto-stores forgetToken
logout() Future<void>
Logout — follows configured strategy, auto-navigates
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resendOtp() Future<CkAuthResult<void>>
Resend OTP — auto-restarts timer
restoreSession() Future<void>
Restore session — called on app launch (auto-called during init)
sendOtp({required CkOtpTrigger trigger, required String recipient}) Future<CkAuthResult<void>>
Send OTP manually — also updates lastTrigger for verify/resend
signIn({required CkLoginRequest request}) Future<CkAuthResult<TProfile>>
Sign in — auto-saves tokens, auto-fetches profile
signInWithApple(CkAppleAuthData data) Future<CkAuthResult<TProfile>>
Authenticate with Apple
signInWithCustom({required String providerName, required Map<String, dynamic> authData}) Future<CkAuthResult<TProfile>>
Authenticate with Custom Social Provider
signInWithFacebook(CkFacebookAuthData data) Future<CkAuthResult<TProfile>>
Authenticate with Facebook
signInWithGoogle(CkGoogleAuthData data) Future<CkAuthResult<TProfile>>
Authenticate with Google
signUp({Map<String, dynamic>? body, List<String>? pathParams, Map<String, dynamic>? queryParams, Map<String, dynamic>? formFields, List<Map<String, dynamic>>? listBody, Map<String, dynamic>? files, Map<String, String>? headers, LoginCallback? loginCallback}) Future<CkAuthResult<TProfile>>
Sign up — returns CkAuthResult with OTP info if needed
toString() String
A string representation of this object.
inherited
updatePassword({required Map<String, dynamic> body, Map<String, String>? headers}) Future<CkAuthResult<void>>
Reset password
updateProfile({Map<String, dynamic>? formFields, Map<String, dynamic>? files, Map<String, dynamic>? jsonBody}) Future<CkAuthResult<TProfile?>>
Updates the profile on the server using the configured profileUpdateUrl.
verifyOtp({required String otp}) Future<CkAuthResult<void>>
Verify OTP — uses stored verification token automatically

Operators

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

Static Properties

instance CkAuthService
no setter
isInitialized bool
no setter

Static Methods

init<TProfile>({required CkAuthConfig<TProfile> config, required CkAuthTokenManager tokenManager}) Future<CkAuthService<TProfile>>
Completes auth module setup. CkTransport must already be initialized.
initForTests<TProfile>({required CkAuthConfig<TProfile> config, required CkAuthTokenManager tokenManager}) Future<CkAuthService<TProfile>>
Test-only factory: creates a fully wired service without calling restoreSession or touching any platform channels. Resets the singleton.
prepareNetwork({required CkAuthConfig config}) Future<CkAuthNetworkBootstrap>
Prepares secure storage, token cache, and CkTokenProvider for Dio. CoreKit calls this, then CkTransport.init, then init.
typedInstance<T>() CkAuthService<T>
Returns the singleton instance cast to a specific profile type T.