modules/common/common_module library
Classes
- Abortable
- An HTTP request that can be aborted before it completes.
- AbortableMultipartRequest
- A MultipartRequest which supports abortion using abortTrigger.
- AbortableRequest
- A Request which supports abortion using abortTrigger.
- AbortableStreamedRequest
- A StreamedRequest which supports abortion using abortTrigger.
- BaseClient
- The abstract base class for an HTTP client.
- BaseConfig
- BaseRequest
- The base class for HTTP requests.
- BaseResponse
- The base class for HTTP responses.
- BaseResponseDonuzModel
- BaseResponseWithUrl
- A BaseResponse with a url field.
- ByteStream
- A stream of chunks of bytes representing a single piece of data.
- Client
- The interface for HTTP clients that take care of maintaining persistent connections across multiple requests to the same server.
- CommomModule
- Disposable
- If objects that are registered inside GetIt implements Disposable the onDispose method will be called whenever that Object is unregistered, reset or its enclosing Scope is popped
- DonuzConfig
- GetIt
- Very simple and easy to use service locator You register your object creation factory or an instance of an object with registerFactory, registerSingleton or registerLazySingleton And retrieve the desired object using get or call your locator as function as its a callable class Additionally GetIt offers asynchronous creation functions as well as functions to synchronize the async initialization of multiple Singletons
- HttpService
- InitDependency
- Data structure used to identify a dependency by type and instanceName
- LocationCoordinates
- MediaType
- A class representing an HTTP media type, as used in Accept and Content-Type headers.
- MultipartFile
- A file to be uploaded as part of a MultipartRequest.
- MultipartRequest
-
A
multipart/form-datarequest. -
ObjectRegistration<
T extends Object> - Request
- An HTTP request where the entire request body is known in advance.
- Response
- An HTTP response where the entire response body is known in advance.
- ShadowChangeHandlers
-
If an object implements the
ShadowChangeHandlerif will get notified if an Object with the same registration type and name is registered on a higher scope which will shadow it. It also will get notified if the shadowing object is removed from GetIt - StorageService
- StreamedRequest
- An HTTP request where the request body is sent asynchronously after the connection has been established and the headers have been sent.
- StreamedResponse
- An HTTP response where the response body is received asynchronously after the headers have been received.
- StringUtil
- WillSignalReady
-
If your singleton that you register wants to use the manually signalling
of its ready state, it can implement this interface class instead of using
the
signalsReadyparameter of the registration functions (you don't really have to implement much ;-) )
Enums
- ObjectRegistrationType
-
You will see a rather esoteric looking test
(const Object() is! T)at several places. It tests ifTis a real type and not Object or dynamic. For each registered factory/singleton an ObjectRegistration<T> is created it holds either the instance of a Singleton or/and the creation functions for creating an instance when get is called
Extensions
Functions
-
delete(
Uri url, {Map< String, String> ? headers, Object? body, Encoding? encoding}) → Future<Response> - Sends an HTTP DELETE request with the given headers to the given URL.
-
get(
Uri url, {Map< String, String> ? headers}) → Future<Response> - Sends an HTTP GET request with the given headers to the given URL.
-
head(
Uri url, {Map< String, String> ? headers}) → Future<Response> - Sends an HTTP HEAD request with the given headers to the given URL.
-
patch(
Uri url, {Map< String, String> ? headers, Object? body, Encoding? encoding}) → Future<Response> - Sends an HTTP PATCH request with the given headers and body to the given URL.
-
post(
Uri url, {Map< String, String> ? headers, Object? body, Encoding? encoding}) → Future<Response> - Sends an HTTP POST request with the given headers and body to the given URL.
-
put(
Uri url, {Map< String, String> ? headers, Object? body, Encoding? encoding}) → Future<Response> - Sends an HTTP PUT request with the given headers and body to the given URL.
-
read(
Uri url, {Map< String, String> ? headers}) → Future<String> - Sends an HTTP GET request with the given headers to the given URL and returns a Future that completes to the body of the response as a String.
-
readBytes(
Uri url, {Map< String, String> ? headers}) → Future<Uint8List> - Sends an HTTP GET request with the given headers to the given URL and returns a Future that completes to the body of the response as a list of bytes.
-
runWithClient<
R> (R body(), Client clientFactory(), {ZoneSpecification? zoneSpecification}) → R -
Runs
bodyin its own Zone with the Client returned byclientFactoryset as the default Client. -
throwIf(
bool condition, Object error) → void - Two handy functions that help me to express my intention clearer and shorter to check for runtime errors
-
throwIfNot(
bool condition, Object error) → void
Typedefs
-
DisposingFunc<
T> = FutureOr Function(T param) -
Signature for disposing function
because closures like
(x){}have a return type of Null we don't useFutureOr<void> -
FactoryFunc<
T> = T Function() - Signature of the factory function used by non async factories
-
FactoryFuncAsync<
T> = Future< T> Function() - Signature of the factory function used by async factories
-
FactoryFuncParam<
T, P1, P2> = T Function(P1 param1, P2 param2) -
For Factories that expect up to two parameters if you need only one use
voidfor the one you don't use -
FactoryFuncParamAsync<
T, P1, P2> = Future< T> Function(P1 param1, P2 param2) -
For async Factories that expect up to two parameters if you need only one use
voidfor the one you don't use - ScopeDisposeFunc = FutureOr Function()
- Signature for disposing function on scope level
Exceptions / Errors
- ClientException
- An exception caused by an error in a pkg/http client.
- RequestAbortedException
- Thrown when an HTTP request is aborted.
- WaitingTimeOutException