CkAuth<TProfile> class

Static developer-facing gateway for authentication operations. Eliminates the need to use CkAuthService.instance directly.

Constructors

CkAuth()
const

Properties

authState → CkAuthStateController
The state controller for reactive auth status.
no setter
availableCkSocialProviders → List<CkSocialProvider>
Available social providers.
no setter
config → CkAuthConfig
The active configuration.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isAuthenticated → bool
Whether the session is currently authenticated.
no setter
isInitialized → bool
Whether CkAuthService is fully initialized.
no setter
loadingController → CkAuthLoadingController
The loading state controller for all auth operations.
no setter
logoutHandler → CkLogoutHandler
The logout handler.
no setter
otpManager → CkOtpFlowManager
The OTP manager for OTP sending and verification countdowns.
no setter
profile → TProfile?
The active user profile. Returns null if unauthenticated.
no setter
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
The social authentication manager.
no setter
tokenManager → CkAuthTokenManager
The token manager for stored auth tokens.
no setter

Methods

changePassword({required Map<String, dynamic> body, Map<String, String>? headers}) → Future<CkAuthResult<void>>
Reset password.
fetchProfile() → Future<CkAuthResult>
Fetches the profile from the server.
forgotPassword({required Map<String, dynamic> body, Map<String, String>? headers}) → Future<CkAuthResult<void>>
Forgot password — auto-stores forgetToken.
loadingUi({required CkAuthLoadingType type, required Widget builder(bool isLoading)}) → Widget
A simplified reactive StreamBuilder UI helper for auth operation loading states.
logout() → Future<void>
Logout — follows configured strategy, auto-navigates.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
otpCountdownUi({required Widget builder(int seconds)}) → Widget
A simplified reactive StreamBuilder UI helper for the OTP resend countdown.
profileUi({required Widget builder(BuildContext context, TProfile? profile), Widget? loading}) → Widget
A simplified reactive StreamBuilder UI helper for the user profile.
resendOtp() → Future<CkAuthResult<void>>
Resend OTP — auto-restarts timer, reuses stored recipient.
resetPassword({required Map<String, dynamic> body, Map<String, String>? headers}) → Future<CkAuthResult<void>>
Reset password.
sendOtp({CkOtpTrigger? trigger, String? recipient}) → Future<CkAuthResult<void>>
Send OTP manually — sets trigger and recipient, calls API, auto-navigates on success.
signIn({String? account, String? username, String? password, Map<String, dynamic>? args, Map<String, String>? headers}) → Future<CkAuthResult>
Sign in — auto-saves tokens, auto-fetches profile.
signInWithApple(CkAppleAuthData data) → Future<CkAuthResult>
Authenticate with Apple.
signInWithCustom({required String providerName, required Map<String, dynamic> authData}) → Future<CkAuthResult>
Authenticate with Custom Social Provider.
signInWithFacebook(CkFacebookAuthData data) → Future<CkAuthResult>
Authenticate with Facebook.
signInWithGoogle(CkGoogleAuthData data) → Future<CkAuthResult>
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>
Sign up — returns CkAuthResult with OTP info if needed.
toString() → String
A string representation of this object.
inherited
updateProfile({Map<String, dynamic>? formFields, Map<String, dynamic>? files, Map<String, dynamic>? jsonBody}) → Future<CkAuthResult>
Updates the profile on the server.
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

password → String?
no setter
username → String?
no setter