ClientRouter class
Browser API client with Flint-style route grouping.
Constructors
-
ClientRouter({String? baseUrl, String prefix = '', Map<
String, String> headers = const {}, Map<String, dynamic> query = const {}, Duration timeout = const Duration(seconds: 30), bool debug = false, bool throwIfError = false, ErrorHandler? onError, RequestDoneCallback? onDone, StatusCodeConfig statusCodeConfig = const StatusCodeConfig()}) - Creates a client router using the current browser origin by default.
- ClientRouter.fromClient(FlintClient client, {String prefix = ''})
- Creates a router around an existing FlintClient.
Properties
- client → FlintClient
-
The underlying Flint HTTP client.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- prefix → String
-
Route prefix applied to relative request paths.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
delete<
T> (String path, {Map< String, dynamic> ? query, Map<String, String> ? headers, JsonParser<T> ? parser, ErrorHandler? onError, RequestDoneCallback<T> ? onDone, Duration? timeout}) → Future<FlintResponse< T> > -
Sends a DELETE request to
path. -
get<
T> (String path, {Map< String, dynamic> ? query, Map<String, String> ? headers, JsonParser<T> ? parser, ErrorHandler? onError, RequestDoneCallback<T> ? onDone, Duration? timeout}) → Future<FlintResponse< T> > -
Sends a GET request to
path. -
group(
String prefix) → ClientRouter -
Returns a new router with
prefixappended to this router's prefix. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
patch<
T> (String path, {dynamic body, Map< String, dynamic> ? query, Map<String, String> ? headers, JsonParser<T> ? parser, ErrorHandler? onError, RequestDoneCallback<T> ? onDone, Duration? timeout}) → Future<FlintResponse< T> > -
Sends a PATCH request to
path. -
post<
T> (String path, {dynamic body, Map< String, dynamic> ? query, Map<String, String> ? headers, JsonParser<T> ? parser, ErrorHandler? onError, RequestDoneCallback<T> ? onDone, Duration? timeout}) → Future<FlintResponse< T> > -
Sends a POST request to
path. -
put<
T> (String path, {dynamic body, Map< String, dynamic> ? query, Map<String, String> ? headers, JsonParser<T> ? parser, ErrorHandler? onError, RequestDoneCallback<T> ? onDone, Duration? timeout}) → Future<FlintResponse< T> > -
Sends a PUT request to
path. -
request<
T> (String method, String path, {dynamic body, Map< String, dynamic> ? query, Map<String, String> ? headers, JsonParser<T> ? parser, ErrorHandler? onError, RequestDoneCallback<T> ? onDone, Duration? timeout}) → Future<FlintResponse< T> > -
Sends a request using
methodand dispatches to the matching verb helper. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited