xapi 0.0.1 xapi: ^0.0.1 copied to clipboard
a dio wraper
xapi #
a dio wraper
Get started #
Add dependency #
xapi:
git:
url: https://soeil@bitbucket.org/soeil/xapi.git
Set file configuration #
Xapi.setConfig(BasicSetting('https://tribelio.app.ittron.co.id/', 5000, 3000));
Set callback for error response and on receive response #
xapi.onErrorResponse = (String message, String type, response) {
print(message);
};
xapi.onReceiveResponse = (dynamic response) {};
GET Request #
Xapi xapi = Xapi();
xapi.onErrorResponse = (String message, String type, response) {
print(message);
};
xapi.onReceiveResponse = (dynamic response) {};
xapi.get(
"api/member/commerceAdmin/GetProduct?lang=en_US&networkId=859&page=1&lat=-7.2681467&statusActive=all&devices=android&isMobile=1&sessionId=20210218180520602e49f092e41&networkAccountId=198&lng=112.7344126",
onReceiveProgress: (a, b) {
print('onReceiveProgress $a $b');
},
);
POST Request #
xapi.post(
'api/',
data: {
'file': xapi.fromFile(file.path, 'aaa.jpg'),
},
onSendProgress: (int a, int b) {
print('onSendProgress $a $b');
}
);
PUT Request #
xapi.put(
'api/',
data: {
'file': xapi.fromFile(file.path, 'aaa.jpg'),
},
onSendProgress: (int a, int b) {
print('onSendProgress $a $b');
}
);
DELETE Request #
Xapi xapi = Xapi();
xapi.onErrorResponse = (String message, String type, response) {
print(message);
};
xapi.onReceiveResponse = (dynamic response) {};
xapi.get(
"api/member/commerceAdmin/GetProduct?lang=en_US&networkId=859&page=1&lat=-7.2681467&statusActive=all&devices=android&isMobile=1&sessionId=20210218180520602e49f092e41&networkAccountId=198&lng=112.7344126",
onReceiveProgress: (a, b) {
print('onReceiveProgress $a $b');
},
);
Download Request #
xapi.download('https://www.google.com/', '${value.path}/x.html', onReceiveProgress: (int a, int b) {
print('onSendProgress $a $b');
});