custom_dio_fix

Creator: coderz1093

Last updated:

0 purchases

custom_dio_fix Image
custom_dio_fix Images

Languages

Categories

Add to Cart

Description:

custom dio fix

custom_dio_fix #
基于custom_dio适配新版 Flutter 的网络请求插件
Getting Started #
start init before you send any request
WidgetsFlutterBinding.ensureInitialized();
CustomDio.setInitData(
CustomDioOptions(
baseUrl: "http://www.google.com",
headers: {"authorization": "Bearer xxx"},
),
);
copied to clipboard
POST #
try {
final data = await CustomDio()
.send(reqMethod: RequestMethod.post, path: "user/login", body: {"email": "email"});
} catch (err) {
print(err.toString());
}
copied to clipboard
GET #
try {
final data = await CustomDio()
.send(reqMethod: RequestMethod.get, path: "user/login", query: {"search": "email"});
} catch (err) {
print(err.toString());
}
copied to clipboard
UPLOAD #
try {
final data = await CustomDio()
.uploadFile(path: "path", filePath: File("").path, body: [
{"one": "one"},
{"two": "two"},
]);
} catch (err) {
print(err.toString());
}


copied to clipboard
uploadBytes #
try {
final data = await CustomDio().uploadBytes(
path: "dio-test/file",
bytesExtension: "png",
bytes: bytes,
body: [
{"content": "sd"},
{"attachments": "attachments"},
]);

return data.data.toString();
} catch (err) {

rethrow;
}
copied to clipboard
delete #
Future delete() async {
try {
final data =
await CustomDio().send(reqMethod: RequestMethod.delete, path: "dio-test/1");
dLog(data.data.toString());
} catch (err) {

}
}
copied to clipboard
getOne #
try {
final data =
await CustomDio().send(reqMethod: RequestMethod.get, path: "dio-test/154");
dLog(data.data.toString());
} catch (err) {

}
}
copied to clipboard
patch #
Future update() async {
try {
final data = await CustomDio().send(
reqMethod: RequestMethod.patch,
path: "dio-test",
body: {"content": "update content"});
dLog(data.data.toString());
} catch (err) {

}
}
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.