DeviceRegistrationCubit class
Cubit for handling the business logic and state management of device registration.
Responsible for fetching organizations, registering devices, and managing device registration state.
- Inheritance
-
- Object
- BlocBase<
DeviceRegistrationState> - Cubit<
DeviceRegistrationState> - DeviceRegistrationCubit
Constructors
- DeviceRegistrationCubit.new({required Databases db})
-
Creates a DeviceRegistrationCubit with the given
db
instance.
Properties
- db → Databases
-
The Appwrite Databases instance for database operations.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClosed → bool
-
Whether the bloc is closed.
no setterinherited
- prefs → PreferenceHelper
-
Helper for accessing user preferences.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → DeviceRegistrationState
-
The current state.
no setterinherited
-
stream
→ Stream<
DeviceRegistrationState> -
The current stream of states.
no setterinherited
Methods
-
addError(
Object error, [StackTrace? stackTrace]) → void -
Reports an
error
which triggers onError with an optional StackTrace.inherited -
clearError(
) → void - Reset the error message.
-
close(
) → Future< void> -
Closes the instance.
This method should be called when the instance is no longer needed.
Once close is called, the instance can no longer be used.
inherited
-
emit(
DeviceRegistrationState state) → void -
Updates the
state
to the providedstate
. emit does nothing if thestate
being emitted is equal to the currentstate
.inherited -
fetchOrganizations(
) → Future< void> - Fetches organizations from the database and updates the state.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onChange(
Change< DeviceRegistrationState> change) → void -
Called whenever a
change
occurs with the givenchange
. Achange
occurs when a newstate
is emitted. onChange is called before thestate
of thecubit
is updated. onChange is a great spot to add logging/analytics for a specificcubit
.inherited -
onError(
Object error, StackTrace stackTrace) → void -
Called whenever an
error
occurs and notifies BlocObserver.onError.inherited -
registerDevice(
) → Future< void> - Submits the device registration data to the database.
-
resetSuccess(
) → void - Reset the success state.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateDeviceName(
String name) → void - Updates the device name.
-
updateKitId(
String id) → void - Updates the kit ID.
-
updateSelectedOrganization(
String name, String id) → void - Updates the selected organization.
-
updateSelectedProductType(
String? type) → void - Updates the selected product type.
-
updateTabletSerialNumber(
String serialNumber) → void - Updates the tablet serial number.
-
updateTocoId(
String id) → void - Updates the Toco ID.
-
validateForm(
) → bool - Validates the form data before submission.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited