ease_http

Creator: coderz1093

Last updated:

0 purchases

ease_http Image
ease_http Images

Languages

Categories

Add to Cart

Description:

ease http

About #
Based on Dart http package, makes http package
more powerful and easier to use.
Features #
Typed response #
Use HttpClient:
import 'package:ease_http/ease_http.dart';

void main() async {
final client = HttpClient();

// response is typed.
final response = await client.get<Map<String, dynamic>>('http://example.com');
client.close();
}
copied to clipboard
Use SingleRequest:
import 'package:ease_http/ease_http.dart';

void main() async {
final request = SingleRequest();

// response is typed.
final response = await request.get<Map<String, dynamic>>('http://example.com');
}
copied to clipboard
Endpoint mapping #
void main() async {
final request = SingleRequest(endpointMap: {
'api_1': 'http://example1.com',
'api_2': 'http://example2.com',
});

final response = await request.get<String>('api_1:foo');
}
copied to clipboard
Build headers on the fly #
void main() async {
final request = SingleRequest(
endpointMap: {
'api_1': 'http://example1.com',
'api_2': 'http://example2.com',
},
headersBuilder: (request) async {
if (request.endpointName == 'api_1') {
return {
'Authorization': 'accessToken',
...request.headers,
};
} else {
return request.headers;
}
},
);

final result = await request.get<String>('api_1:foo');
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.