netter 0.0.2
netter: ^0.0.2 copied to clipboard
A package responsible for network requests
Netter #
A package responsible for network requests and return model that you registered in ModelRegistry contains data fetched from api #
Netter.init("base url");
ModelRegistry.register<User>((json) => User.fromJson(json));
try {
final result = await NetterClient.instance.sendRequest<User>(
RequestInput(
path: "endpoint",
body: {},
headers: {"Content-Type": "application/json"},
queryParam: {"key": Firebase.apiKey},
request: HttpMethod.post,
),
);
return Right(result);
} catch (e) {
return Left(Failure(e.toString()));
}