asnetworkmanager 0.0.1 asnetworkmanager: ^0.0.1 copied to clipboard
ASNetworkManager is a delightful networking library for flutter
asnetworkmanager #
A new Flutter package.
Getting Started #
This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
Example #
1) Call POST API from async function
//CREATE OBJECT OF
NetworkManager _manager = NetworkManager();
//REQUEST URL
String url = "http://*****.*****.com:3000/api/users/login";
//HEADER
Map<String, dynamic> header;
header = {
'Content-Type': 'application/json'
};
//POST BODY
Map<String, dynamic> body;
body = {
"email": "xx@gmail.com",
"password": "12345678"
};
//CALL POST API AND STORE RESPONSE IN response
final response = await _manager.postAPICall(url, body : body, header: header);
2) CALL GET API
//CREATE OBJECT OF
NetworkManager _manager = NetworkManager();
//REQUEST URL
String url = "http://*****.*****.com:3000/api/products";
//HEADER
Map<String, dynamic> header;
header = {
'Content-Type': 'application/json'
};
//CALL GET API AND STORE RESPONSE IN response
final response = await _provider.getAPICall(url, header : headers);