OrganizationCubit class
Cubit for managing the state and logic of the organization details screen.
Handles fetching organization details, including device, mother, and test counts for each organization. Also manages Excel export and date filtering.
- Inheritance
-
- Object
- BlocBase<
OrganizationState> - Cubit<
OrganizationState> - OrganizationCubit
Constructors
- OrganizationCubit.new({required BuildContext context})
- Creates an OrganizationCubit and initializes the state and data.
Properties
- addressController ↔ TextEditingController
-
getter/setter pair
- contactPersonController ↔ TextEditingController
-
getter/setter pair
- context → BuildContext
-
The BuildContext used for showing snackbars and dialogs.
final
- db → Databases
-
Appwrite Databases instance for organization data operations.
final
- emailController ↔ TextEditingController
-
getter/setter pair
-
formKey
→ GlobalKey<
FormState> -
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClosed → bool
-
Whether the bloc is closed.
no setterinherited
- mobileController ↔ TextEditingController
-
getter/setter pair
- nameController ↔ TextEditingController
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → OrganizationState
-
The current state.
no setterinherited
-
stream
→ Stream<
OrganizationState> -
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 -
applySearchFilter(
) → void - Filters organizations based on the search query.
-
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.
override
-
downloadExcel(
) → Future< void> - Downloads the filtered organizations data in Excel format.
-
emit(
OrganizationState state) → void -
Updates the
state
to the providedstate
. emit does nothing if thestate
being emitted is equal to the currentstate
.inherited -
fetchOrganizationDetails(
) → Future< void> - Fetches organizations from the database based on the date range.
-
initializeOrganizationFields(
Map< String, dynamic> data) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onChange(
Change< OrganizationState> 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 -
setFromDate(
DateTime? date) → void - Sets the from date for filtering.
-
setSelectedCity(
String? cityName) → void -
setSelectedDesignation(
String? designation) → void -
setSelectedState(
String? stateName) → void -
setSelectedType(
String? type) → void -
setTillDate(
DateTime? date) → void - Sets the till date for filtering.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateChanges(
String documentId) → Future< void> -
updateSearchQuery(
String query) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited