repository library
A reactive repository toolkit for Flutter with HTTP, caching, dependency tracking, auto refresh, and UI integration.
Classes
-
BaseRepository<
Data, Actions> - A BaseRepository is a class that holds data and provides a stream. It can be used to fetch data from a remote source, cache it, and provide a stream of that data.
- CreateSessionWithPassword
- Input passed to a password request body mapper.
- DeveloperRepositoryLogger
-
A RepositoryLogger that uses
dart:developerto log messages. This is the default logger used byRepository. It's not recommended to use this logger in production. - ExchangeOAuthAuthorizationCode
- Input used to exchange an OAuth authorization code for a session.
- HttpRepositoryHttpClient
-
A RepositoryHttpClient that uses
httppackage. - InMemoryRepositorySessionStorage
- Volatile session storage useful for tests and non-persistent sessions.
-
RefreshSession<
Session extends RepositorySession> - Input passed to a refresh request body mapper.
-
Repository<
Data, Actions> -
A
Repositorythat fetches data from an HTTP endpoint. Can be used both directly (instanciation) and by inheritance. - RepositoryAbsoluteUrl
- A URL that is independent from the configured base URL.
-
RepositoryAuthenticationBuilder<
Session extends RepositorySession> - Builds typed authentication methods for one concrete session family.
- RepositoryAuthenticationFailure
- A typed authentication failure returned by session operations.
- RepositoryAuthenticationHttpFailure
- An authentication endpoint returned a non-successful status code.
-
RepositoryAuthenticationRequest<
Input, Output> -
HTTP operation whose response is decoded into
Output. - RepositoryAuthenticationUnexpectedFailure
- Sending or decoding an authentication request failed.
-
RepositoryBearerSessionManager<
Authentication> - Bearer manager returned by RepositorySessionManager.bearer.
-
RepositoryBuilder<
Data, RepositoryActionsType> - A widget that builds itself based on the latest state of a repository.
- RepositoryCacheStorage
-
An abstract storage to cache data from repositories.
It is used by the
Repositoryclass and wraps an implementation of a cache storage. - RepositoryClient
- Configures the shared infrastructure used by repositories.
- RepositoryCookieJar
-
Cookie persistence and request integration used by
.cookies()sessions. -
RepositoryCookiesSessionManager<
Authentication> - Cookie manager returned by RepositorySessionManager.cookies.
-
RepositoryCustomAuthentication<
Input, Session extends RepositorySession> - Application-specific authentication method.
-
RepositoryEnvironment<
Authentication> - Values returned when repository authentication is configured.
- RepositoryHttpClient
-
Abstract class for HTTP client to be used in http
Repositories. You can use this class to create your own HTTP client, or just use the default one. - RepositoryHttpMockedRequest
- Identifies a mocked request by URL and method.
- RepositoryHttpRequest
- This is used by RepositoryHttpClient to make HTTP requests. You can use this class to create your own HTTP client, or just use the default one.
- RepositoryHttpResponse
- A class that represents the response from a HTTP request.
- RepositoryInterceptor
- Intercepts repository HTTP requests and responses.
- RepositoryLogger
- Abstract class for logging in repositories. You can use this class to create your own logger, or just use the default one.
-
RepositoryOAuthAuthorizationCodeAuthentication<
Session extends RepositorySession> - OAuth authorization-code exchange that adopts the decoded session.
-
RepositoryPasswordAuthentication<
Session extends RepositorySession> - Password authentication configured by RepositoryAuthenticationBuilder.
-
RepositoryPasswordlessAuthentication<
Session extends RepositorySession, Challenge> - Two-step passwordless code authentication.
-
RepositoryPasswordlessChallenge<
Session extends RepositorySession, Challenge> - Result of the first step in a passwordless flow.
- RepositoryRelativeUrl
- A URL resolved against the configured base URL.
- RepositorySession
- Base type for sessions managed by the repository runtime.
- RepositorySessionBearer
-
A session applied through the
Authorization: Bearerheader. - RepositorySessionCookies
- A session whose credentials are maintained by a cookie jar.
-
RepositorySessionLogout<
Session extends RepositorySession> - Optional remote logout request.
-
RepositorySessionManager<
Authentication> - Configures one built-in session strategy and its typed auth methods.
-
RepositorySessionRefresh<
Session extends RepositorySession> - Configuration for a session refresh endpoint.
- RepositorySessionRuntime
- Internal seam used by clients and repositories without depending on a concrete session manager.
- RepositorySessionState
- Public state exposed by a repository session manager.
- RepositorySessionStateAuthenticated
- A usable authenticated session is available.
- RepositorySessionStateError
- Resolving the persisted session failed.
- RepositorySessionStatePending
- The persisted session is still being resolved.
- RepositorySessionStateUnauthenticated
- No authenticated session is available.
- RepositorySessionStorage
- Persistence dedicated to authentication credentials.
-
RepositoryState<
Data> - A generic class that holds a value of the current state of the repository.
-
RepositoryStateError<
Data> - A RepositoryState for a load failure without previous content to display.
-
RepositoryStatePending<
Data> - A RepositoryState that indicates that content is not available yet.
-
RepositoryStateReady<
Data> - A RepositoryState that indicates that the repository has successfully loaded data.
- RepositoryUrl
- A URL used by repository requests.
- RequestPasswordlessCode
- Input passed to the first step of a passwordless code flow.
-
SignOutSession<
Session extends RepositorySession> - Input passed to an optional remote logout body mapper.
-
VerifyPasswordlessCode<
Challenge> - Input passed to the verification step of a passwordless code flow.
-
ZipRepository<
Data> - A BaseRepository that combines multiple BaseRepositorys into one. Can be used both directly (instantiation) and by inheritance.
Enums
- RepositoryAccess
- Controls whether a repository uses the configured session.
- RepositoryDatasource
- The source of the current data in the repository.
- RepositoryHttpMethod
- HTTP methods supported by repository requests.
- RepositoryLoggingLevel
- The level of logging.
- RepositorySessionChange
- Describes a change that affects authenticated repository data.
Functions
-
createPlatformHttpClient(
{TokenBuilder? tokenBuilder, Client? client, bool closeClient = false}) → RepositoryHttpClient - Creates the default HTTP adapter for the current platform.
Typedefs
- BearerToken = String
-
A type alias for bearer token String.
Notice that this is just the token, without the
Bearerprefix. - NoRepositoryActions = ()
- The actions type used by repositories without custom operations.
- NoRepositoryAuthentication = ()
- Empty authentication surface used by configurations without a manager.
-
RepositoryActionExecutor<
Data> = Future< Either< Function<Failure, Output> >Failure, Output>({required RepositoryActionRun< Failure, Output> run, FutureOr<Data> update(Data? current, Output output)?}) - Executes an action and applies its successful output to repository data.
-
RepositoryActionRun<
Failure, Output> = FutureOr< Either< Function(RepositoryClient client)Failure, Output> > - Runs an action using the repository's configured client.
-
RepositoryActionsFactory<
Data, Actions> = Actions Function(RepositoryActionExecutor< Data> execute) - Creates the typed actions exposed by a repository.
-
RepositoryAuthenticationBody<
Input> = Map< String, dynamic> Function(Input input) - Maps a typed operation input into a JSON request body.
-
RepositoryAuthenticationDecoder<
Output> = FutureOr< Output> Function(RepositoryAuthenticationJson json) - Maps an endpoint response into its typed result.
-
RepositoryAuthenticationJson
= Map<
String, Object?> - A JSON object returned by an authentication endpoint.
-
RepositoryBuilderBuilder<
Data, Actions> = Widget Function(BuildContext context, RepositoryState< Data> state, Actions actions) - A package aimed at providing seamless integration between the repository library and Flutter, creating a communication widget between them.
-
RepositoryRefreshDecoder<
Session extends RepositorySession> = FutureOr< Session> Function(RepositoryAuthenticationJson json, Session current) - Maps a refresh response and current session into a replacement session.
-
RepositoryRequestHandler
= Future<
RepositoryHttpResponse> Function(RepositoryHttpRequest request) - Executes the next step in a repository HTTP request pipeline.
-
TokenBuilder
= FutureOr<
BearerToken?> Function() - Builds the bearer token used to authenticate an HTTP request.
Exceptions / Errors
- Indicates that an HTTP request could not reach the network.
- RepositoryAuthenticationRequiredException
- A request attempted to use authenticated access without a session.
- UnexpectedStatusCodeException
-
A
Repositorythat fetches data from an HTTP endpoint. Can be used both directly (instanciation) and by inheritance.