Compare commits

..

2 Commits

Author SHA1 Message Date
zhuce 988052630a 添加一些工具类 2024-03-09 14:28:23 +08:00
zhuce f5817af759 添加http模块 2024-03-07 21:03:16 +08:00
9 changed files with 1367 additions and 57 deletions

20
lib/api/login_api.dart Normal file
View File

@ -0,0 +1,20 @@
import 'package:autosos_flutter/util/xhttp.dart';
class LoginApi {
static XHttp xHttp = XHttp.getInstance();
static void login(int type, String username, String password, String code,
String cid, String openid, String unionid) async {
var data = {
"type": type,
"username": username,
"password": password,
"code": code,
"getui_cid": cid,
"wx_openid": openid,
"wx_unionid": unionid
};
var post = await xHttp.post("/v2/auth/get-access-token", data);
// print(post);
}
}

81
lib/config/constant.dart Normal file
View File

@ -0,0 +1,81 @@
class Constant{
//
static const String testHost = "http://api.test.jjsos.cn/";
//线
static const String host = "http://api.jjsos.cn/";
//host
static const String pictureHost = "http://pic.jjsos.cn/";
//
static const String testWorkOrderUrl = "http://backend.test.jjsos.cn/old/elc-work-new-app?order_id=";
static const String workOrderUrl = "http://backend.jjsos.cn/old/elc-work-new-app?order_id=";
//线
static bool isOrderStar = false;
//
static bool isOpen = false;
//
static bool weberror=false;
//
static int heartbeatTime = 0;
static int onlineTime = 0;
//
static bool isService = false;
static bool isMain = false;
//
static bool hasMessage = false;
static bool hasMessageInform = false;
static const String WX_ID = "wx3bd407849a19c609";
static const String WX_Secret = "efb0ca67e9b2a58fb5b460b8b4153563";
//
static double lat = 0.00;
static double lng = 0.00;
static String address = "";
//退
static const String OUT_LOGIN_TOKEN = "OUT_LOGIN_TOKEN";
//
static const String ORDER_EMPTY_SIGN_TOKEN = "ORDER_EMPTY_SIGN_TOKEN";
// token
static const String ORDER_NEW_TOKEN = "ORDER_NEW_TOKEN";
//
static const String ORDER_CANCEL_TOKEN = "ORDER_CANCEL_TOKEN";
//
static const String ORDER_EMPTY_TOKEN = "ORDER_EMPTY_TOKEN";
//
static const String ORDER_REFRESH_TOKEN = "ORDER_REFRESH_TOKEN";
//
static const String ORDER_PAY_TOKEN = "ORDER_PAY_TOKEN";
//
static const String ORDER_COMPLETE_TOKEN = "ORDER_COMPLETE_TOKEN";
//token
//
static const int NEW_ORDER_INSIDE = 1;
//
static const int NEW_ORDER_JIUJIU = 2;
//
static const int ORDER_BACKSTAGE_CLOSE = 3;
//
static const int ORDER_BACKSTAGE_MODIFY = 4;
//
static const int ORDER_BACKSTAGE_CLOSE_CHARGE = 5;
//
static const int WHETHER_ARRIVE_SCENE = 6;
//线
static const int ENTERED_OFFLINE_MODE = 7;
//
static const int ORDER_WHETHER_CLOSE = 8;
//
static const int ORDER_COMPLETE = 9;
//app-
static String newVersion="4.1.3.9";
// 0=1=2=3= 4=() 5=()
static int NECUPDATE =0;
static bool isDriverMessage = false;
static bool isServiceTrailer = true;
static String arriveTipsStr = "";
static String uploadStartStr = "";
}

View File

@ -1,6 +1,7 @@
import 'package:autosos_flutter/pages/home/home_page.dart'; import 'package:autosos_flutter/pages/home/home_page.dart';
import 'package:autosos_flutter/pages/login/login_page.dart'; import 'package:autosos_flutter/pages/login/login_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
void main() { void main() {
runApp(const MyApp()); runApp(const MyApp());
@ -13,11 +14,13 @@ class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
title: 'Flutter Demo', title: 'Flutter Demo',
theme: ThemeData( theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true, useMaterial3: true,
), ),
home: const LoginPage()); home: const LoginPage(),
builder: EasyLoading.init(),
);
} }
} }

View File

@ -1,5 +1,10 @@
import 'package:autosos_flutter/api/login_api.dart';
import 'package:autosos_flutter/util/xhttp.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class LoginPage extends StatefulWidget { class LoginPage extends StatefulWidget {
const LoginPage({super.key}); const LoginPage({super.key});
@ -8,6 +13,8 @@ class LoginPage extends StatefulWidget {
} }
class _LoginPageState extends State<LoginPage> { class _LoginPageState extends State<LoginPage> {
final TextEditingController _unameController = TextEditingController();
final TextEditingController _pwdController = TextEditingController();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -47,39 +54,54 @@ class _LoginPageState extends State<LoginPage> {
color: Colors.grey, color: Colors.grey,
), ),
), ),
const Expanded(
child: TextField(
decoration: InputDecoration(hintText: "请输入手机号"),
)),
],
),
),
const Padding(
padding: EdgeInsets.all(20),
child: Row(
children: [
Expanded( Expanded(
child: TextField( child: TextField(
decoration: InputDecoration(hintText: "请输入密码"), controller: _unameController,
)) decoration: const InputDecoration(hintText: "请输入手机号"),
)),
], ],
), ),
), ),
Padding( Padding(
padding: const EdgeInsets.all(20), padding: const EdgeInsets.all(20),
child: Container( child: Row(
padding: const EdgeInsets.all(12), children: [
margin: const EdgeInsets.only(top: 40), Expanded(
width: MediaQuery.of(context).size.width, child: TextField(
decoration: BoxDecoration(color: Colors.grey,borderRadius: BorderRadius.circular(21)), controller: _pwdController,
child: const Center( decoration: const InputDecoration(hintText: "请输入密码"),
child: Text( ))
"登录", ],
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), ),
))), ),
Padding(
padding: const EdgeInsets.all(20),
child: GestureDetector(
onTap:()=>_login(),
child: Container(
padding: const EdgeInsets.all(12),
margin: const EdgeInsets.only(top: 40),
width: MediaQuery
.of(context)
.size
.width,
decoration: BoxDecoration(color: Colors.grey,
borderRadius: BorderRadius.circular(21)),
child: const Center(
child: Text(
"登录",
style: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold),
))),)
) )
], ],
), ),
); );
} }
void _login() async{
String username = _unameController.text;
String password = _pwdController.text;
LoginApi.login(1, username, password, "", "", "", "");
}
} }

View File

@ -0,0 +1,15 @@
import 'package:autosos_flutter/util/sp_util.dart';
import 'package:basic_utils/basic_utils.dart';
import 'package:uuid/uuid.dart';
class DeviceIdUtils{
static String? getDeviceId(){
SPUtil spUtil = SPUtil();
var deviceId = spUtil.get<String>("JJdeviceId");
if(StringUtils.isNullOrEmpty(deviceId)){
var uuid = const Uuid();
return uuid.v1();
}
return deviceId;
}
}

85
lib/util/sp_util.dart Normal file
View File

@ -0,0 +1,85 @@
import 'dart:convert';
import 'package:shared_preferences/shared_preferences.dart';
class SPUtil{
//
static SPUtil? _instance;
factory SPUtil() => _instance ??= SPUtil._initial();
SharedPreferences? _preferences;
//
SPUtil._initial() {
//init 使async/await
init();
}
//SharedPreferences
void init() async {
_preferences ??= await SharedPreferences.getInstance();
}
// 使 SharedPreferences ,static
static Future<SPUtil?> perInit() async {
if (_instance == null) {
//访
SharedPreferences preferences = await SharedPreferences.getInstance();
_instance = SPUtil._pre(preferences);
}
return _instance;
}
SPUtil._pre(SharedPreferences prefs) {
_preferences = prefs;
}
///String
void setString(key, value) {
_preferences?.setString(key, value);
}
///setStringList
void setStringList(key, value) {
_preferences?.setStringList(key, value);
}
///setBool
void setBool(key, value) {
_preferences?.setBool(key, value);
}
///setDouble
void setDouble(key, value) {
_preferences?.setDouble(key, value);
}
///setInt
void setInt(key, value) {
_preferences?.setInt(key, value);
}
///Json
void setJson(key, value) {
value = jsonEncode(value);
_preferences?.setString(key, value);
}
///
T? get<T>(key) {
var result = _preferences?.get(key);
if (result != null) {
return result as T;
}
return null;
}
///JSON
Map<String, dynamic>? getJson(key) {
String? result = _preferences?.getString(key);
if (result!=null && result!='') {
return jsonDecode(result);
}
return null;
}
///StringUtilisNotEmpty
/// static isNotEmpty(String? str) {
/// return str?.isNotEmpty ?? false;
/// }
///
void clean() {
_preferences?.clear();
}
///
void remove(key) {
_preferences?.remove(key);
}
}

826
lib/util/xhttp.dart Normal file
View File

@ -0,0 +1,826 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
/// dio XHttp
class XHttp {
static const String GET = "GET";
static const String POST = "POST";
static const String PUT = "PUT";
static const String PATCH = "PATCH";
static const String DELETE = "DELETE";
static const CUSTOM_ERROR_CODE = 'DIO_CUSTOM_ERROR'; //
static const REQUEST_TYPE_STR = 'REQUEST'; //
static const RESPONSE_TYPE_STR = 'RESPONSE'; //
static const ERROR_TYPE_STR = 'RESPONSE_ERROR'; //
static const DEFAULT_LOAD_MSG = '请求中...'; //
static const CONNECT_TIMEOUT = 60000; //
static const RECEIVE_TIMEOUT = 60000; //
static const SEND_TIMEOUT = 60000; //
static const DIALOG_TYPE_OTHERS = 'OTHERS'; // -
static const DIALOG_TYPE_TOAST = 'TOAST'; // -
static const DIALOG_TYPE_ALERT = 'ALERT'; // -
static const DIALOG_TYPE_CUSTOM = 'CUSTOM'; // -
static String loadMsg = DEFAULT_LOAD_MSG; //
static String errorShowTitle = '发生错误啦'; //
static String errorShowMsg = ''; //
static CancelToken cancelToken = CancelToken(); // token
static CancelToken whiteListCancelToken = CancelToken(); // token token
final Map<String, CancelToken> _pendingRequests = {}; //
static Dio dio = Dio();
// static Dio dio;
String _getBaseUrl() => 'http://api.test.jjsos.cn';
/// 使
XHttp._internal() {
if ('' == dio.options.baseUrl) {
dio = Dio(BaseOptions(
baseUrl: _getBaseUrl(),
// contentType: ,
// responseType: ,
headers: {'Content-Type': 'application/json'},
connectTimeout: const Duration(milliseconds: CONNECT_TIMEOUT),
receiveTimeout: const Duration(milliseconds: RECEIVE_TIMEOUT),
sendTimeout: const Duration(milliseconds: SEND_TIMEOUT),
extra: {'cancelDuplicatedRequest': true}, //
));
_init();
}
}
///
static final XHttp _instance = XHttp._internal();
///
void _removePendingRequest(String tokenKey) {
if (_pendingRequests.containsKey(tokenKey)) {
// pending
_pendingRequests[tokenKey]?.cancel(tokenKey);
_pendingRequests.remove(tokenKey);
}
}
/// dio
void _init() {
//
dio.interceptors.add(
InterceptorsWrapper(
onRequest: (RequestOptions options, handler) async {
if (kDebugMode) {
print("请求之前");
}
if (dio.options.extra['cancelDuplicatedRequest'] == true && options.cancelToken == null) {
String tokenKey = [
options.method,
options.baseUrl + options.path,
jsonEncode(options.data ?? {}),
jsonEncode(options.queryParameters ?? {})
].join('&');
_removePendingRequest(tokenKey);
options.cancelToken = CancelToken();
options.extra['tokenKey'] = tokenKey;
_pendingRequests[tokenKey] = options.cancelToken!;
}
_handleRequest(options, handler);
// token token token
// XHttp.setToken() token
// String token = 'Bearer xxxxx';
// if (token != dio.options.headers['authorization']) {
// dio.options.headers['authorization'] = token;
// options.headers['authorization'] = token; //
// }
return handler.next(options);
},
onResponse: (Response response, ResponseInterceptorHandler handler) {
if (kDebugMode) {
print("响应之前");
}
_handleResponse(response, handler);
RequestOptions option = response.requestOptions;
if (dio.options.extra['cancelDuplicatedRequest'] == true && option.cancelToken == null) {
_removePendingRequest(option.extra['tokenKey']);
}
String code = (response?.data ?? {})['code'].toString();
String msg = (response?.data ?? {})['message'] ?? response.statusMessage;
// // code == '200' data
bool isSuccess = option.contentType != null && option.contentType!.contains("text") || code == '200';
response.data = Result(response.data, isSuccess, response.statusCode!, msg, headers: response.headers);
return handler.next(response);
},
onError: (DioException error, handler) {
if (kDebugMode) {
print("出错之前");
}
_handleError(error);
if (!CancelToken.isCancel(error) && dio.options.extra['cancelDuplicatedRequest'] == true) {
_pendingRequests.clear(); //
}
// Result Result
if (error.response != null && error.response?.data != null) {
error.response?.data = Result(
error.response?.data, false, error.response!.statusCode!, errorShowMsg ?? error.response!.statusMessage!,
headers: error.response?.headers);
} else {
throw Exception(errorShowMsg);
}
return handler.next(error);
},
),
);
// print("初始化 Dio 完成\n请求超时限制:$CONNECT_TIMEOUT ms\n接收超时限制:$RECEIVE_TIMEOUT ms\n发送超时限制:$SEND_TIMEOUT ms\nDio-BaseUrl${dio.options.baseUrl}\nDio-Headers${dio.options.headers}");
}
/// request
void _handleRequest(RequestOptions options, handler) {
Toast.hide();
Toast.loading(loadMsg);
Map logData = {
'url': options.baseUrl + options.path,
'method': options.method,
'headers': options.headers,
'data': options.data ?? options.queryParameters, // GET url 使 queryParameters
};
_dealRequestInfo(logData, REQUEST_TYPE_STR);
}
/// response
void _handleResponse(Response response, handler) {
Map logData = {
'url': response.requestOptions.uri,
'method': response.requestOptions.method,
'headers': response.headers,
'data': response.data,
'statusCode': response.statusCode,
'statusMessage': response.statusMessage,
};
_dealRequestInfo(logData, RESPONSE_TYPE_STR);
Toast.hide();
}
/// error
void _handleError(DioException error) {
// 退
String errorTypeInfo = '其他错误!';
switch (error.type) {
case DioExceptionType.connectionTimeout:
errorTypeInfo = '连接超时!';
break;
case DioExceptionType.sendTimeout:
errorTypeInfo = "请求超时!";
break;
case DioExceptionType.receiveTimeout:
errorTypeInfo = "响应超时!";
break;
case DioExceptionType.badResponse:
errorTypeInfo = "服务异常!";
break;
case DioExceptionType.cancel:
errorTypeInfo = "请求取消!";
break;
case DioExceptionType.unknown:
default:
break;
}
Map logData = {
'url': error.requestOptions.baseUrl + error.requestOptions.path,
'method': error.requestOptions.method,
'headers': error.response?.headers,
'data': error.response?.data,
'statusCode': error.response?.statusCode,
'statusMessage': error.response?.statusMessage,
'errorType': error.type,
'errorMessage': error.message,
'errorTypeInfo': errorTypeInfo,
};
_dealRequestInfo(logData, ERROR_TYPE_STR);
Toast.hide();
errorShowMsg =
"$errorShowTitle ${error.response?.statusCode ?? 'unknown'} $errorTypeInfo \n ${error.response?.statusMessage ?? ''} ${error.message ?? ''} \n ${error.response?.data ?? ''}";
}
/// REQUEST RESPONSE RESPONSE_ERROR
String _dealRequestInfo(Map logData, String logType) {
String logStr = "\n";
logStr += "========================= $logType START =========================\n";
logStr += "- URL: ${logData['url']} \n";
logStr += "- METHOD: ${logData['method']} \n";
// logStr += "- HEADER: \n { \n";
// logStr += parseData(logData['headers']);
// logStr += "\n } \n";
if (logData['data'] != null) {
logStr += "- ${logType}_BODY: \n";
logStr += "!!!!!----------*!*##~##~##~##*!*##~##~##~##*!*----------!!!!! \n";
logStr += "${parseData(logData['data'])} \n";
logStr += "!!!!!----------*!*##~##~##~##*!*##~##~##~##*!*----------!!!!! \n";
}
if (logType.contains(RESPONSE_TYPE_STR)) {
logStr += "- STATUS_CODE: ${logData['statusCode']} \n";
logStr += "- STATUS_MSG: ${logData['message']} \n";
}
if (logType == ERROR_TYPE_STR) {
logStr += "- ERROR_TYPE: ${logData['errorType']} \n";
logStr += "- ERROR_MSG: ${logData['errorMessage']} \n";
logStr += "- ERROR_TYPE_INFO: ${logData['errorTypeInfo']} \n";
}
logStr += "========================= $logType E N D =========================\n";
logWrapped(logStr);
return logStr;
}
///
Future _showResultDialog(Response? response, resultDialogConfig) async {
if (response == null) {
return;
}
resultDialogConfig = resultDialogConfig ?? {};
String dialogType = resultDialogConfig['type'] ?? XHttp.DIALOG_TYPE_TOAST;
if (dialogType == XHttp.DIALOG_TYPE_OTHERS) {
return; // OTHERS
}
bool isSuccess = response?.data?.success ?? false;
String msg = response?.data?.msg ?? '未知错误';
if (dialogType == XHttp.DIALOG_TYPE_TOAST) {
// resultDialogConfig successMsg, errorMsg
isSuccess
? Toast.show(resultDialogConfig['successMsg'] ?? msg, type: Toast.SUCCESS)
: Toast.show(resultDialogConfig['errorMsg'] ?? msg, type: Toast.ERROR);
return;
}
if (dialogType == XHttp.DIALOG_TYPE_ALERT) {
// resultDialogConfig title, content, closeable, showCancel, cancelText, confirmText, confirmCallback, cancelCallback, closeCallback ...
// Utils.showDialog(...);
return;
}
if (dialogType == XHttp.DIALOG_TYPE_CUSTOM) {
// resultDialogConfig onSuceess, onError
if (isSuccess) {
if (resultDialogConfig['onSuccess'] != null) {
resultDialogConfig['onSuccess'](response.data);
}
} else {
if (resultDialogConfig['onError'] != null) {
resultDialogConfig['onError'](response.data);
}
}
}
}
///
void _catchOthersError(e) {
String errMsg = "${errorShowMsg ?? e}$CUSTOM_ERROR_CODE".split(CUSTOM_ERROR_CODE)[0];
int errMsgLength = errMsg.length;
String errshowMsg = errMsgLength > 300 ? errMsg.substring(0, 150) : errMsg;
if (e is DioException) {
if (CancelToken.isCancel(e)) {
Toast.show('Cancel Request Successful'); //
return;
}
Toast.show(errshowMsg, type: Toast.WARNING);
return;
}
Toast.show(errshowMsg + "\n......", type: Toast.ERROR);
}
/// XHttp.xxx static get/post XHttp.getInstance().xxx
static XHttp getInstance({String? baseUrl, String? msg}) {
String targetBaseUrl = baseUrl ?? _instance._getBaseUrl();
loadMsg = msg ?? DEFAULT_LOAD_MSG;
if (dio.options.baseUrl != targetBaseUrl) {
dio.options.baseUrl = targetBaseUrl;
}
return _instance;
}
///
static XHttp cancelRequest() {
Toast.hide();
if (dio.options.extra['cancelDuplicatedRequest'] == true) {
_instance._pendingRequests.forEach((tokenKey, cancelToken) {
cancelToken.cancel('cancel request $tokenKey');
});
} else {
cancelToken.cancel('cancel request');
cancelToken = CancelToken(); // cancelToken 使 cancelToken
}
return _instance;
}
/// cancelToken
static XHttp cancelWhiteListRequest() {
Toast.hide();
whiteListCancelToken.cancel('cancel whiteList request');
whiteListCancelToken = CancelToken();
return _instance;
}
/// cancelToken
static CancelToken getCancelToken() {
return cancelToken;
}
/// whiteListCancelToken
static CancelToken getWhiteListCancelToken() {
return whiteListCancelToken;
}
/// cancelToken
static CancelToken getNewCancelToken() {
return CancelToken();
}
/// get
Future get(String url, [Map<String, dynamic>? params, resultDialogConfig, bool isCancelWhiteList = false]) async {
// 使 request
//
Response response = {} as Response;
CancelToken requestToken = CancelToken();
if (dio.options.extra['cancelDuplicatedRequest'] != true || isCancelWhiteList) {
if (isCancelWhiteList) {
requestToken = whiteListCancelToken;
} else {
requestToken = cancelToken;
}
}
try {
if (params != null) {
response = await dio.get(url, queryParameters: params, cancelToken: requestToken);
return response.data;
} else {
response = await dio.get(url, cancelToken: requestToken);
return response.data;
}
} catch (e) {
_catchOthersError(e);
} finally {
_showResultDialog(response, resultDialogConfig);
}
}
/// post
Future post(String url, [Map<String, dynamic>? data, resultDialogConfig, bool isCancelWhiteList = false]) async {
// 使 request
Response response;
CancelToken requestToken = CancelToken();
if (dio.options.extra['cancelDuplicatedRequest'] != true || isCancelWhiteList) {
if (isCancelWhiteList) {
requestToken = whiteListCancelToken;
} else {
requestToken = cancelToken;
}
}
try {
response = await dio.post(url, data: data, cancelToken: requestToken);
return response.data;
} catch (e) {
_catchOthersError(e);
} finally {
_showResultDialog(null, resultDialogConfig);
}
}
/// put
Future put(String url, [Map<String, dynamic>? data, resultDialogConfig, bool isCancelWhiteList = false]) async {
// 使 request
Response response = {} as Response;
CancelToken requestToken = {} as CancelToken ;
if (dio.options.extra['cancelDuplicatedRequest'] != true || isCancelWhiteList) {
if (isCancelWhiteList) {
requestToken = whiteListCancelToken;
} else {
requestToken = cancelToken;
}
}
try {
response = await dio.put(url, data: data, cancelToken: requestToken);
return response.data;
} catch (e) {
_catchOthersError(e);
} finally {
_showResultDialog(response, resultDialogConfig);
}
}
/// patch
Future patch(String url, [Map<String, dynamic>? data, resultDialogConfig, bool isCancelWhiteList = false]) async {
// 使 request
Response response = {} as Response;
CancelToken requestToken = {} as CancelToken ;
if (dio.options.extra['cancelDuplicatedRequest'] != true || isCancelWhiteList) {
if (isCancelWhiteList) {
requestToken = whiteListCancelToken;
} else {
requestToken = cancelToken;
}
}
try {
response = await dio.patch(url, data: data, cancelToken: requestToken);
return response.data;
} catch (e) {
_catchOthersError(e);
} finally {
_showResultDialog(response, resultDialogConfig);
}
}
/// delete
Future delete(String url, [Map<String, dynamic>? data, resultDialogConfig, bool isCancelWhiteList = false]) async {
// 使 request
Response response = {} as Response;
CancelToken requestToken = {} as CancelToken ;
if (dio.options.extra['cancelDuplicatedRequest'] != true || isCancelWhiteList) {
if (isCancelWhiteList) {
requestToken = whiteListCancelToken;
} else {
requestToken = cancelToken;
}
}
try {
response = await dio.delete(url, data: data, cancelToken: requestToken);
return response.data;
} catch (e) {
_catchOthersError(e);
} finally {
_showResultDialog(response, resultDialogConfig);
}
}
/// request
static Future request(
String url, {
String method = XHttp.GET,
Map<String, dynamic>? queryParameters,
Map<String, dynamic>? data,
bool isCancelWhiteList = false,
resultDialogConfig,
Options? options,
void Function(int, int)? onSendProgress,
void Function(int, int)? onReceiveProgress,
String? msg,
required String baseUrl,
}) async {
XHttp.getInstance(baseUrl: baseUrl, msg: msg);
Response response = {} as Response;
CancelToken requestToken = {} as CancelToken ;
if (dio.options.extra['cancelDuplicatedRequest'] != true || isCancelWhiteList) {
if (isCancelWhiteList) {
requestToken = whiteListCancelToken;
} else {
requestToken = cancelToken;
}
}
try {
response = await dio.request(
url,
options: options ?? Options(method: method, contentType: Headers.formUrlEncodedContentType),
queryParameters: queryParameters,
data: data,
cancelToken: requestToken,
onReceiveProgress: onReceiveProgress,
onSendProgress: onSendProgress,
);
return response.data;
} catch (e) {
_instance._catchOthersError(e);
} finally {
_instance._showResultDialog(
response,
resultDialogConfig ?? {'type': XHttp.DIALOG_TYPE_OTHERS},
); // request
}
}
///
Future downloadFile(urlPath, savePath, [resultDialogConfig, bool isCancelWhiteList = false]) async {
Response response = {} as Response;
CancelToken requestToken = {} as CancelToken;
if (dio.options.extra['cancelDuplicatedRequest'] != true || isCancelWhiteList) {
if (isCancelWhiteList) {
requestToken = whiteListCancelToken;
} else {
requestToken = cancelToken;
}
}
try {
response = await dio.download(urlPath, savePath, onReceiveProgress: (int count, int total) {
//
print("$count $total");
}, cancelToken: requestToken);
return response.data;
} catch (e) {
_catchOthersError(e);
} finally {
_showResultDialog(response, resultDialogConfig);
}
}
// /// post Web
// Future postForm(String url, [Map<String, dynamic> params, resultDialogConfig, bool isCancelWhiteList = false]) async {
// Response response;
// var requestToken;
// if (dio.options.extra['cancelDuplicatedRequest'] != true || isCancelWhiteList) {
// if (isCancelWhiteList) {
// requestToken = whiteListCancelToken;
// } else {
// requestToken = cancelToken;
// }
// }
// try {
// response = await dio.post(url, queryParameters: params, cancelToken: requestToken);
// return response.data;
// } catch (e) {
// _catchOthersError(e);
// } finally {
// _showResultDialog(response, resultDialogConfig);
// }
// }
/// +++++++++++++++++++++++++ retry/proxy退 +++++++++++++++++++++++++
/// baseUrl
static String getBaseUrl() {
return dio.options.baseUrl;
}
/// baseUrl
static XHttp setBaseUrl(String baseUrl) {
dio.options.baseUrl = baseUrl;
return _instance;
}
/// headers
static Map getHeaders() {
return dio.options.headers;
}
/// headers
static dynamic getHeader(String key) {
return dio.options.headers[key];
}
/// headers
// static XHttp setHeaders(Map headers) {
// dio.options.headers = headers;
// return _instance;
// }
/// headers
static XHttp setHeader(String key, String value) {
dio.options.headers[key] = value;
return _instance;
}
///
static XHttp removeHeader(String key) {
dio.options.headers.remove(key);
return _instance;
}
///
static XHttp removeAllHeaders() {
dio.options.headers.clear();
return _instance;
}
///
static Map getRequestTimeout() {
return {
'connectTimeout': dio.options.connectTimeout,
'receiveTimeout': dio.options.receiveTimeout,
'sendTimeout': dio.options.sendTimeout
};
}
///
static XHttp setRequestTimeout(int timeout) {
dio.options.connectTimeout = Duration(milliseconds: timeout);
dio.options.receiveTimeout = Duration(milliseconds: timeout);
dio.options.sendTimeout = Duration(milliseconds: timeout);
return _instance;
}
///
static XHttp setConnectTimeout(int timeout) {
dio.options.connectTimeout = Duration(milliseconds: timeout);
return _instance;
}
///
static XHttp setReceiveTimeout(int timeout) {
dio.options.receiveTimeout = Duration(milliseconds: timeout);
return _instance;
}
///
static XHttp setSendTimeout(int timeout) {
dio.options.sendTimeout = Duration(milliseconds: timeout);
return _instance;
}
///
static Map<String, dynamic>? getAuthUser() {
String token = dio.options.headers['authorization'];
if (null == token) {
return null;
}
// token
return {'account': 'xxx', 'name': 'xxx', 'roles': 'xxx'};
}
/// token
static XHttp setAuthToken([String? token]) {
if (null == token) {
dio.options.headers.remove('authorization');
} else {
dio.options.headers['authorization'] = token;
}
return _instance;
}
///
static XHttp setErrorTitle(String msg) {
errorShowTitle = msg;
return _instance;
}
///
static bool isCancel(e) {
return CancelToken.isCancel(e);
}
// ///
// static XHttp setContentType(String contentType) {
// dio.options.contentType = contentType;
// return _instance;
// }
// ///
// static XHttp setContentTypeMultipartForm() {
// dio.options.contentType = "multipart/form-data";
// return _instance;
// }
// ///
// static XHttp setDataType(ResponseType dataType) {
// dio.options.responseType = dataType;
// return _instance;
// }
// ///
// static XHttp setDataTypeJson() {
// dio.options.responseType = ResponseType.json;
// return _instance;
// }
// ----- [cookie/charset/accept/encoder/decoder] headers -----
}
/// ====================================================== ======================================================
///
String parseData(data) {
String responseStr = "";
if (data is Map) {
responseStr += data.mapToStructureString();
} else if (data is FormData) {
final formDataMap = Map()
..addEntries(data.fields)
..addEntries(data.files);
responseStr += formDataMap.mapToStructureString();
} else if (data is List) {
responseStr += data.listToStructureString();
} else {
responseStr += data.toString();
}
return responseStr;
}
/// log log
void logWrapped(String text) {
final pattern = RegExp('.{1,800}'); // 800 is the size of each chunk
pattern.allMatches(text).forEach((match) => print(match.group(0)));
}
/// Map Map
extension Map2StringEx on Map {
String mapToStructureString({int indentation = 0, String space = " "}) {
if (this == null || this.isEmpty) {
return "$this";
}
String result = "";
String indentationContent = space * indentation;
result += "{";
this.forEach((key, value) {
if (value is Map) {
result += "\n$indentationContent" + "\"$key\": ${value.mapToStructureString(indentation: indentation + 1)},";
} else if (value is List) {
result += "\n$indentationContent" + "\"$key\": ${value.listToStructureString(indentation: indentation + 1)},";
} else {
result += "\n$indentationContent" + "\"$key\": ${value is String ? "\"$value\"," : "$value,"}";
}
});
result = result.substring(0, result.length - 1); //
result += "\n$indentationContent}";
return result;
}
}
/// List List
extension List2StringEx on List {
String listToStructureString({int indentation = 0, String space = " "}) {
if (this == null || this.isEmpty) {
return "$this";
}
String result = "";
String indentationContent = space * indentation;
result += "[";
for (var value in this) {
if (value is Map) {
result +=
"\n$indentationContent" + space + "${value.mapToStructureString(indentation: indentation + 1)},"; //
} else if (value is List) {
result += value.listToStructureString(indentation: indentation + 1);
} else {
result += "\n$indentationContent" + value is String ? "\"$value\"," : "$value,";
}
}
result = result.substring(0, result.length - 1); //
result += "\n$indentationContent]";
return result;
}
}
///
class Result {
var data;
bool success;
int code;
String msg;
var headers;
Result(this.data, this.success, this.code, this.msg, {this.headers});
}
class Toast {
Toast._() {
// EasyLoading
// EasyLoading.instance.loadingStyle = EasyLoadingStyle.custom;
//
}
static final Toast _instance = Toast._();
static const String SUCCESS = "SUCCESS";
static const String ERROR = "ERROR";
static const String WARNING = "WARNING";
static const String INFO = "INFO";
static loading(String msg) {
EasyLoading.show(status: msg);
}
static progeress(double value, String msg) {
EasyLoading.showProgress(value, status: msg);
}
static show(String msg, {String? type}) {
switch (type) {
case Toast.SUCCESS:
EasyLoading.showSuccess(msg);
break;
case Toast.ERROR:
EasyLoading.showError(msg);
break;
case Toast.WARNING:
EasyLoading.showInfo(msg);
break;
case Toast.INFO:
default:
EasyLoading.showToast(msg);
break;
}
}
static hide() {
EasyLoading.dismiss();
}
}
// /// 使 baseUrl getInstance() getpost static baseUrl request getpost baseUrl
// XHttp.getInstance().post("/user/login", {
// "username": username,
// "password": password
// }).then((res) {
// // DO SOMETHING
// }).catchError((err) {
// // DO SOMETHING
// });

View File

@ -6,7 +6,7 @@ packages:
description: description:
name: amap_flutter_base name: amap_flutter_base
sha256: "9ef2439b8de7100cdd1b4357701b8ca8c059c0f2d9d0257b81750bbf0c6f53bb" sha256: "9ef2439b8de7100cdd1b4357701b8ca8c059c0f2d9d0257b81750bbf0c6f53bb"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.0" version: "3.0.0"
amap_flutter_location: amap_flutter_location:
@ -14,7 +14,7 @@ packages:
description: description:
name: amap_flutter_location name: amap_flutter_location
sha256: f35ff00e196d579608e0bc28ccbc1f6f53787644702f947de941f775769cc701 sha256: f35ff00e196d579608e0bc28ccbc1f6f53787644702f947de941f775769cc701
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.0" version: "3.0.0"
amap_flutter_map: amap_flutter_map:
@ -22,7 +22,7 @@ packages:
description: description:
name: amap_flutter_map name: amap_flutter_map
sha256: "9cebb0b2f5fc7d3ae0427e99c41edc883e8f5459f6a28bc850f0f9e16918cf2f" sha256: "9cebb0b2f5fc7d3ae0427e99c41edc883e8f5459f6a28bc850f0f9e16918cf2f"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.0" version: "3.0.0"
async: async:
@ -30,15 +30,23 @@ packages:
description: description:
name: async name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.11.0" version: "2.11.0"
basic_utils:
dependency: "direct main"
description:
name: basic_utils
sha256: "2064b21d3c41ed7654bc82cc476fd65542e04d60059b74d5eed490a4da08fc6c"
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.7.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
characters: characters:
@ -46,7 +54,7 @@ packages:
description: description:
name: characters name: characters
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
clock: clock:
@ -54,7 +62,7 @@ packages:
description: description:
name: clock name: clock
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.1" version: "1.1.1"
collection: collection:
@ -62,36 +70,92 @@ packages:
description: description:
name: collection name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.18.0" version: "1.18.0"
convert:
dependency: transitive
description:
name: convert
sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.1"
crypto:
dependency: transitive
description:
name: crypto
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.3"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
name: cupertino_icons name: cupertino_icons
sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.6" version: "1.0.6"
dio:
dependency: "direct main"
description:
name: dio
sha256: "49af28382aefc53562459104f64d16b9dfd1e8ef68c862d5af436cc8356ce5a8"
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.4.1"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.1" version: "1.3.1"
ffi:
dependency: transitive
description:
name: ffi
sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
file:
dependency: transitive
description:
name: file
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
url: "https://pub.flutter-io.cn"
source: hosted
version: "7.0.0"
fixnum:
dependency: transitive
description:
name: fixnum
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_easyloading:
dependency: "direct main"
description:
name: flutter_easyloading
sha256: ba21a3c883544e582f9cc455a4a0907556714e1e9cf0eababfcb600da191d17c
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.5"
flutter_lints: flutter_lints:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: flutter_lints name: flutter_lints
sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.3" version: "2.0.3"
flutter_plugin_android_lifecycle: flutter_plugin_android_lifecycle:
@ -99,28 +163,81 @@ packages:
description: description:
name: flutter_plugin_android_lifecycle name: flutter_plugin_android_lifecycle
sha256: b068ffc46f82a55844acfa4fdbb61fad72fa2aef0905548419d97f0f95c456da sha256: b068ffc46f82a55844acfa4fdbb61fad72fa2aef0905548419d97f0f95c456da
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.17" version: "2.0.17"
flutter_spinkit:
dependency: transitive
description:
name: flutter_spinkit
sha256: b39c753e909d4796906c5696a14daf33639a76e017136c8d82bf3e620ce5bb8e
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.2.0"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
http:
dependency: transitive
description:
name: http
sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
http_parser:
dependency: transitive
description:
name: http_parser
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.2"
js:
dependency: transitive
description:
name: js
sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.7.1"
json_annotation:
dependency: transitive
description:
name: json_annotation
sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.8.1"
lints: lints:
dependency: transitive dependency: transitive
description: description:
name: lints name: lints
sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
logging:
dependency: transitive
description:
name: logging
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.12.16" version: "0.12.16"
material_color_utilities: material_color_utilities:
@ -128,7 +245,7 @@ packages:
description: description:
name: material_color_utilities name: material_color_utilities
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.5.0" version: "0.5.0"
meta: meta:
@ -136,7 +253,7 @@ packages:
description: description:
name: meta name: meta
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.10.0" version: "1.10.0"
path: path:
@ -144,17 +261,113 @@ packages:
description: description:
name: path name: path
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.3" version: "1.8.3"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.1"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.2"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.1"
platform:
dependency: transitive
description:
name: platform
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.4"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: plugin_platform_interface name: plugin_platform_interface
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.8" version: "2.1.8"
pointycastle:
dependency: transitive
description:
name: pointycastle
sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.7.4"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
sha256: "81429e4481e1ccfb51ede496e916348668fd0921627779233bd24cc3ff6abd02"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.2"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.1"
shared_preferences_foundation:
dependency: transitive
description:
name: shared_preferences_foundation
sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.3.5"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.3.2"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.3.2"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.2"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.3.2"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -165,15 +378,23 @@ packages:
description: description:
name: source_span name: source_span
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.10.0" version: "1.10.0"
sprintf:
dependency: transitive
description:
name: sprintf
sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"
url: "https://pub.flutter-io.cn"
source: hosted
version: "7.0.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.11.1" version: "1.11.1"
stream_channel: stream_channel:
@ -181,7 +402,7 @@ packages:
description: description:
name: stream_channel name: stream_channel
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.2" version: "2.1.2"
stream_transform: stream_transform:
@ -189,7 +410,7 @@ packages:
description: description:
name: stream_transform name: stream_transform
sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
string_scanner: string_scanner:
@ -197,7 +418,7 @@ packages:
description: description:
name: string_scanner name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
term_glyph: term_glyph:
@ -205,7 +426,7 @@ packages:
description: description:
name: term_glyph name: term_glyph
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.1" version: "1.2.1"
test_api: test_api:
@ -213,15 +434,31 @@ packages:
description: description:
name: test_api name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.6.1" version: "0.6.1"
typed_data:
dependency: transitive
description:
name: typed_data
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.2"
uuid:
dependency: "direct main"
description:
name: uuid
sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.3.3"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.4" version: "2.1.4"
web: web:
@ -229,9 +466,25 @@ packages:
description: description:
name: web name: web
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.3.0" version: "0.3.0"
win32:
dependency: transitive
description:
name: win32
sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8"
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.2.0"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
sdks: sdks:
dart: ">=3.2.6 <4.0.0" dart: ">=3.2.6 <4.0.0"
flutter: ">=3.7.0" flutter: ">=3.16.0"

View File

@ -33,6 +33,11 @@ dependencies:
amap_flutter_location: ^3.0.0 amap_flutter_location: ^3.0.0
amap_flutter_map: ^3.0.0 amap_flutter_map: ^3.0.0
dio: ^5.4.1
flutter_easyloading: ^3.0.5
shared_preferences: ^2.2.2
basic_utils: ^5.7.0
uuid: ^4.3.3
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.