fkernal_firebase library
FKernal Firebase Integration
This is an optional module for Firebase/Firestore integration.
Installation
- Add Firebase dependencies to your pubspec.yaml:
dependencies:
cloud_firestore: ^5.0.1
firebase_auth: ^5.1.0
firebase_storage: ^12.0.1
- Import this module instead of the main fkernal:
import 'package:fkernal/fkernal_firebase.dart';
Usage
await FKernal.init(
config: FKernalConfig(
baseUrl: '', // Not used for Firebase
networkClientOverride: FirebaseNetworkClient(),
),
endpoints: firebaseEndpoints,
);
Classes
-
ActionButton<
T> - Simplified action trigger that handles a single action.
- ApiClient
- REST Implementation of INetworkClient using Dio.
- AuthConfig
- Authentication configuration.
- AutoEmptyWidget
- Empty state widget when no data is available.
- AutoErrorWidget
- Default error widget shown when data fetching fails.
- AutoLoadingWidget
- Default loading widget shown during data fetching.
- CacheConfig
- Cache configuration for endpoints.
- CounterSlice
- A specialized slice for counters.
- DefaultSecureStorageProvider
- Default FlutterSecureStorage-based secure storage provider.
- Endpoint
- Declarative endpoint definition.
- EndpointRegistry
- Registry for managing endpoint definitions.
- ErrorConfig
- Error behavior configuration.
- ErrorHandler
- Centralized error handler for the framework.
- FeatureFlags
- Feature flags for enabling/disabling functionality.
- FirebaseNetworkClient
- Firebase Implementation of INetworkClient. Fully utilizes Firestore, Auth, and Storage.
- FKernal
- Main FKernal framework class.
-
FKernalActionBuilder<
T> - Builder widget for performing actions (mutations) on endpoints.
- FKernalApp
- Wrapper widget that provides FKernal services to the widget tree.
-
FKernalBuilder<
T> - Builder widget for consuming resource state from endpoints.
- FKernalConfig
- Main configuration container for FKernal.
- FKernalCounterBuilder
- Builder for CounterSlice.
-
FKernalListBuilder<
T> - Builder for ListSlice.
- FKernalLoadMoreIndicator
- A convenience widget for the load more button/indicator.
-
FKernalLocalBuilder<
T> - Builder widget for consuming local (non-API) state from FKernal.
- FKernalModel
- Interface for models that support validation and serialization.
-
FKernalPaginatedBuilder<
T> - Optional pagination builder for infinite scroll lists.
- FKernalProvider
- Provides access to FKernal state management from the widget tree.
- FKernalToggleBuilder
- Builder for ToggleSlice (booleans).
-
FKernalValueBuilder<
T> - Builder for ValueSlice (simple single values).
- HiveStorageProvider
- Default Hive-based storage provider.
- INetworkClient
- Interface for network clients (REST, GraphQL, gRPC).
- ISecureStorageProvider
- Interface for secure storage.
- IStorageProvider
- Interface for storage providers (Hive, SQLite, etc.).
- KernelEvent
- A kernel event for devtools and logging.
- KernelObserver
- Base class for kernel observers.
-
ListSlice<
T> - A specialized local slice for lists.
-
LocalSlice<
T> - A local state slice for managing non-API state within FKernal.
- LoggingKernelObserver
- Default logger observer.
-
MapSlice<
K, V> - A specialized local slice for maps.
- PaginationConfig
- Pagination configuration.
-
ResourceData<
T> - Data state - data was successfully loaded.
-
ResourceError<
T> - Error state - an error occurred while fetching.
-
ResourceInitial<
T> - Initial state - no fetch has been attempted.
-
ResourceKey<
T> - A type-safe key for accessing resource state.
-
ResourceLoading<
T> - Loading state - data is being fetched.
-
ResourceState<
T> - Represents the state of a resource fetched from an endpoint.
- ShimmerLoading
- Shimmer loading placeholder for lists.
- StateManager
- Central state manager for the application.
- StorageManager
- Manages local storage, caching, and secure storage via swappable providers.
- ThemeConfig
- Theme configuration for the application.
- ThemeManager
- Manages theming for the application.
- ToggleSlice
- A specialized slice for boolean toggles.
-
ValueSlice<
T> - A specialized local slice for simple value types.
Enums
- Environment
- Environment configuration for the app.
- FKernalErrorType
- Types of errors that can occur in the framework.
- HttpMethod
- HTTP methods supported by the framework.
- KernelEventType
- Types of kernel events for observability.
- KernelHealthStatus
- Status of the FKernal subsystem.
Extensions
- EnvironmentX on Environment
- Extension methods for Environment.
- FKernalContextExtensions on BuildContext
- Extension methods on BuildContext for accessing FKernal services.
- HttpMethodX on HttpMethod
- Extension methods for HttpMethod.
Functions
-
performAction<
T> (BuildContext context, String endpointId, {dynamic payload, Map< String, String> ? pathParams}) → Future<T> - Triggers an action on an endpoint.
-
refreshResource<
T> (BuildContext context, String endpointId, {Map< String, dynamic> ? params, Map<String, String> ? pathParams}) → Future<T> - Refreshes data for an endpoint.
-
useResource<
T> (BuildContext context, String endpointId, {Map< String, dynamic> ? params, Map<String, String> ? pathParams, bool autoFetch = true}) → ResourceState<T> - A hook-like helper to fetch and subscribe to resource state.
Typedefs
- ErrorCallback = void Function(FKernalError error)
- Callback for error handling.
-
ResponseParser<
T> = T Function(dynamic json) - Response parser function type.
Exceptions / Errors
- FKernalError
- Unified error type for the FKernal framework.