NetworkRequest class
This class is a wrapper around http
and provides a simple
interface for making network requests.
Should be used inside your repository.
Constructors
-
NetworkRequest({required String baseUrl, required String path, NetworkMethod method = NetworkMethod.get, Map<
String, dynamic> ? query}) - Creates a new NetworkRequest.
Properties
- baseUrl → String
-
The base URL of the request.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- method → NetworkMethod
-
The HTTP method of the request.
Defaults to NetworkMethod.get.
final
- path → String
-
The path of the request.
final
-
query
→ Map<
String, dynamic> ? -
The query of the request.
https://example.com/api/v1/data?queryKey=queryValue&queryKey2=queryValue2
final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
fire(
{Object? body, Map< String, String> ? headers}) → Future<Map< String, Object?> > - Fire the request.
-
fireAndMap<
T> (T mapper(Map< String, Object?> ), {Object? body, Map<String, String> ? headers}) → Future<T> - Fire the request.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited