core library
Core utilities: Result, exceptions, extensions, logger, config, validation schemas, async state, and dependency injection.
This replaces the old package:primekit_core/primekit_core.dart import.
Classes
-
AsyncBuilder<
T> - A stateless widget that builds UI from an AsyncState.
-
AsyncData<
T> - A successfully resolved state carrying the produced value.
-
AsyncError<
T> - A failed state carrying the error and an optional stackTrace.
-
AsyncLoading<
T> - The initial, empty loading state — no data or error is available.
-
AsyncRefreshing<
T> - A refreshing state that shows previousValue while a new load is in flight.
-
AsyncState<
T> - Represents the four possible states of an asynchronous operation: loading, data, error, and refreshing.
-
AsyncStateBuilder<
T> - A ListenableBuilder wrapper that rebuilds whenever notifier changes and renders via an AsyncBuilder.
-
AsyncStateNotifier<
T> - A ChangeNotifier that drives a single async operation and exposes its result as an AsyncState.
- DiModule
- A logical grouping of service registrations.
-
Failure<
S, F> - The failure variant of Result.
-
PaginatedNotifier<
T> -
A ChangeNotifier that manages paginated loading for a list of
T. -
PaginatedState<
T> - Immutable snapshot of a paginated list's state.
- PkBoolSchema
- A schema that validates boolean values.
- PkDateSchema
- A schema that validates DateTime values.
- PkDisposable
- Implemented by services that need deterministic cleanup when their enclosing ServiceLocator scope is torn down.
- PkForm
- A container widget that manages a group of fields validated by a PkObjectSchema.
- PkFormController
- Controller vended to PkForm's builder that lets child widgets read form state and trigger actions imperatively.
-
PkFormField<
T> - A Flutter form field backed by a PkSchema.
- PkFormScope
- An InheritedWidget that makes PkFormController available to all descendant widgets.
-
PkListSchema<
T> -
A schema that validates a List where each element is validated by
itemSchema. - PkNumberSchema
- A schema that validates numeric values (both int and double).
- PkObjectSchema
- A schema that validates a Map<String, dynamic> by delegating each key to its corresponding child schema.
-
PkSchema<
T> - The abstract base for all Primekit schema validators.
- PkServiceScopeWidget
- An InheritedWidget that creates a ServiceScope for its subtree and disposes it when removed from the tree.
- PkStringSchema
- A schema that validates string values.
- PrimekitConfig
-
Global Primekit configuration. Call PrimekitConfig.initialize once
in your
main()before using any modules. - PrimekitLogger
- Internal structured logger used across all Primekit modules.
-
Result<
S, F> -
A discriminated union representing either a successful value
Sor a failureF. - ServiceDescriptor
- Metadata for a registered service.
- ServiceLocator
- Lightweight service locator with lifecycle management.
- ServiceScope
- A child scope that inherits registrations from a parent ServiceLocator but maintains its own instance cache for ServiceLifetime.scoped services.
-
Success<
S, F> - The success variant of Result.
- ValidationResult
- The result of a schema validation operation.
Enums
- PrimekitEnvironment
- The deployment environment.
- PrimekitLogLevel
- Controls how much Primekit logs.
- ServiceLifetime
- Defines how long a registered service instance lives.
Extensions
- PrimekitDateTimeExtensions on DateTime
- DateTime extension methods.
-
PrimekitListExtensions
on List<
T> - List and Iterable extension methods.
-
PrimekitMapExtensions
on Map<
K, V> - Map extension methods.
-
PrimekitNullableListExtensions
on List<
T> ? - Nullable iterable extensions.
-
PrimekitNullableMapExtensions
on Map<
K, V> ? - Nullable map extensions.
- PrimekitNullableStringExtensions on String?
- Nullable string extensions.
- PrimekitStringExtensions on String
- String extension methods.
Typedefs
-
PkResult<
T> = Result< T, PrimekitException> - Convenience typedef for results that fail with a PrimekitException.
Exceptions / Errors
- AuthException
- Thrown for authentication-related failures.
- BillingException
- Thrown for billing and in-app purchase failures.
- ConfigurationException
- Thrown when Primekit is misconfigured.
- EmailException
- Thrown when an email send operation fails.
- NetworkException
- Thrown when a network request fails.
- NoConnectivityException
- Thrown when the device has no network connectivity.
- PermissionDeniedException
- Thrown when a required permission is denied.
- PrimekitException
- Base exception class for all Primekit errors.
- PurchaseCancelledException
- Thrown when a purchase is cancelled by the user.
- StorageException
- Thrown for local storage failures.
- TimeoutException
- Thrown when a request times out.
- TokenExpiredException
- Thrown when an auth token has expired.
- Thrown when the user is not authorized to access a resource.
- ValidationException
- Thrown when input validation fails.