MagicStarterAuthController class

Auth controller for Magic Starter plugin.

Supports 3 identity modes for login and registration:

  • Email-only (default): auth.email=true, auth.phone=false
  • Phone-only: auth.email=false, auth.phone=true
  • Both: auth.email=true, auth.phone=true — caller selects by passing the populated field; phone takes precedence when non-empty.
Inheritance

Properties

firstError → String?
Get the first validation error message.
no setterinherited
hasErrors → bool
Check if there are any validation errors.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
initialized → bool
Whether the controller has been initialized.
no setterinherited
isDisposed → bool
Whether the controller has been disposed.
no setterinherited
isEmpty → bool
Check if empty (no data).
no setterinherited
isError → bool
Check if an error occurred.
no setterinherited
isLoading → bool
Check if currently loading.
no setterinherited
isSuccess → bool
Check if successfully loaded.
no setterinherited
pendingSocialProvider → String?
The provider whose sign-in flow is open, or null when none is.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
rxState → bool?
Get the current state.
no setterinherited
rxStatus → RxStatus
Get the current status.
no setterinherited
validationErrors ↔ Map<String, String>
Current validation errors keyed by field name.
getter/setter pairinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
authorize(String ability, [Object? arguments]) → void
Authorize an action against the current Auth.user via the Gate.
inherited
clearErrors() → void
Clear all validation errors.
inherited
clearFieldError(String field) → void
Clear a specific field's validation error.
inherited
completeSignIn(Map<String, dynamic>? body, {bool navigate = true, bool saveCredentials = false}) → Future<bool>
Concludes a sign-in from the backend's response body.
inherited
dispose() → void
Runs onClose if it has not run yet, then releases the notifier.
inherited
doForgotPassword({required String email}) → Future<void>
Request a password reset link.
doLogin({String? email, String? phone, required String password, bool rememberMe = false}) → Future<void>
Login user with API credentials.
doRegister({required String name, String? email, String? phone, bool subscribeNewsletter = false, required String password, required String passwordConfirmation}) → Future<void>
Register a new user.
doResetPassword({required String token, required String email, required String password, required String passwordConfirmation}) → Future<void>
Reset password with token.
doSocialSignIn(String provider) → Future<void>
Signs in with provider through the registered social login bridge.
doTwoFactorChallenge({required String twoFactorToken, String? code, String? recoveryCode}) → Future<void>
Completes the two-factor authentication challenge.
doVerifyEmail({required String id, required String hash, required String expires, required String signature}) → Future<void>
Verifies an email address from the mailed link.
errorFieldFor(String wireKey) → String
Map a raw wire validation key to the form field it should report on.
inherited
fetchList<E>(String url, E fromMap(Map<String, dynamic>), {String dataKey = 'data', Map<String, dynamic>? query, Map<String, String>? headers}) → Future<void>
Fetch a list of resources and auto-manage loading/success/error/empty states.
inherited
fetchOne(String url, bool fromMap(Map<String, dynamic>), {String dataKey = 'data', Map<String, dynamic>? query, Map<String, String>? headers}) → Future<void>
Fetch a single resource and auto-manage loading/success/error states.
inherited
forgotPassword() → Widget
Render forgot password view via registry key.
getError(String field) → String?
Get the validation error message for a field.
inherited
handleApiError(MagicResponse response, {String? fallback}) → void
Handle API error response automatically.
inherited
hasError(String field) → bool
Check if a field has a validation error.
inherited
login() → Widget
Render login view via registry key.
logout() → Future<void>
Logout user.
Navigate to wherever a signed-in user should land after authenticating.
inherited
Navigate to path when a navigator context is available.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
onClose() → void
Called when the controller is about to be disposed.
inherited
onInit() → void
Called when the controller is first created.
inherited
refreshUI() → void
Refresh the UI by notifying listeners.
inherited
register() → Widget
Render register view via registry key.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
renderState(Widget onSuccess(bool state), {Widget? onLoading, Widget onError(String message)?, Widget? onEmpty}) → Widget
Render UI based on current status.
inherited
resetPassword() → Widget
Render reset password view via registry key.
setEmpty() → void
Set empty state (no data).
inherited
setError(String message) → void
Set error state with message.
inherited
setErrorsFromMap(Map<String, List<String>> errors) → void
Set validation errors from a raw wire error map, keyed by errorFieldFor.
inherited
setErrorsFromResponse(MagicResponse response) → void
Set validation errors from an API response.
inherited
setLoading() → void
Set loading state.
inherited
setState(bool? newState, {RxStatus? status, bool notify = true}) → void
Update state and/or status.
inherited
setSuccess(bool data) → void
Set success state with data.
inherited
toString() → String
A string representation of this object.
inherited
twoFactorChallenge() → Widget
Render two-factor challenge view via registry key.
validate(Map<String, dynamic> data, Map<String, List<Rule>> rules, {Map<String, String> attributes = const <String, String>{}}) → Map<String, dynamic>
Validate the given data against the rules.
inherited
validateRequest(FormRequest request, Map<String, dynamic> data) → Map<String, dynamic>
Run a FormRequest through this mixin's error bag instead of FormRequest.validate().
inherited
validateRequestAsync(FormRequest request, Map<String, dynamic> data) → Future<Map<String, dynamic>>
Same contract as validateRequest, but validates through Validator.validateAsync so any AsyncRule in request's rules actually runs.
inherited
verifyEmail() → Widget
Render the mailed email verification page via registry key.

Operators

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

Static Properties

instance → MagicStarterAuthController
no setter