Last updated:
0 purchases
one request
one_request #
A simple all in one web request package. #
Features #
Package used dio ,flutter_easyloading, either_dart. Thanks All of them.
Usage #
Include short and useful examples for package users. Navigate
to /test folder for example.
Add oneRequest.loadingconfig under main() and async it.
void main() async {
// Add Here
oneRequest.loadingconfig();
runApp(const MyApp());
}
copied to clipboard
Add oneRequest.initLoading under runapp() inside Materialapp
@override
Widget build(BuildContext context) {
return MaterialApp(
// Add as Builder
builder: oneRequest.initLoading,
title: 'Flutter Demo one_request',
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
copied to clipboard
Call api example:
// Create an instance
final request = oneRequest();
// store the respone
var value = await request.send(
// Url requared
url: 'https://google.com',
// Method ('GET','POST','PUT','DELETE',)
method: RequestType.GET,
// Header data Map<String,dynamic> (Optional)
header: {'test': 'test'},
// Body data Map<String,dynamic> (Optional)
body: {'test': 'test'},
// Boolean value , true is FormData, Default is false (Optional)
formData: false,
//MaxRedirect count, Default is 1 (Optional)
maxRedirects: 1,
// Request Timeout, Default is 60 Second (Optional)
timeout: 60,
// ContentType, Default is 'application/json' (Optional)
contentType: ContentType.json,
// ['stream','json','plain','bytes'], Default is 'json' (Optional)
responsetype: ResponseType.json,
// If responce type is {'status':success,'message': 'text','data':[]} or indner content containing all response in 'data' key the make it true,initialy false
innderData : false,
);
copied to clipboard
Additional information #
loading Config can be modified #
// Custom loading Configuration
oneRequest.loadingconfig(
// BackgroundColor of loading
backgroundColor: Colors.amber,
// Loading indicator Widget
indicator: const CircularProgressIndicator(),
// Loading Indicator Colour
indicatorColor: Colors.red,
// Progress Indicator Colour
progressColor: Colors.red,
// Text Color
textColor: Colors.red,
// Success Widget
success : const Icon(
Icons.check,
color: Colors.green,
),
// Error Widget
error : const Icon(
Icons.error,
color: Colors.red,
),
// Info Widget
info : const Icon(
Icons.info,
color: Colors.blue,
),
);
copied to clipboard
loading Widget Only can be modified to use on multi purpose outside one_request #
// only loading indictor Customize
oneRequest.loadingconfig(
// Widget
indicator: const CircularProgressIndicator(),
// Text
status: 'loading',
);
copied to clipboard
dismiss loading #
// dissmiss loading
oneRequest.dismissLoading;
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.