request_api_helper 2.0.6 request_api_helper: ^2.0.6 copied to clipboard
http, shared_preferences helper for Lavarel and other.
request_api_helper #
1.Setting inside main #
Env(
confurl: 'https://url/api/',
confnoapiurl: 'https://url/',
confclientId: 'client id laravel',
confclientsecret: 'client secret laravel',
confgrantType: 'password',
).save();
set login first
Auth(username: 'your username',password:'your password', exception:false).login()
2.how to use Get / Post http? #
dynamic response = await Post(
name: (route after /api/),
body: {
'example' : 'this example',
},
logResponse: true/false (to see response processed),
exception : true/false (show exception Error),
).request();
optional customUrl, example = 'https://example.com/api/custom/request/v1' [full url needed].
optional customHeader.
3.how to save / load shared_preference? #
Session().save('name','FDhunter');
Session().save('number',12390123);
Session().save('login',true);
note : name session must be different.
String name = await Session().load('name');
int number = await Session().load('number');
bool loginState = await Session().load('login');