Kaynağa Gözat

[New]新增dio、retrofit、get依赖

zhipeng 1 yıl önce
ebeveyn
işleme
b160a47c58

+ 15 - 0
lib/base/base_app_request.dart

@@ -0,0 +1,15 @@
+import 'package:electronic_assistant/base/base_request.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+part 'base_app_request.g.dart';
+
+@JsonSerializable()
+class BaseAppRequest extends BaseRequest {
+  @JsonKey(name: "authToken")
+  late String authToken;
+
+  BaseAppRequest(this.authToken);
+
+  @override
+  Map<String, dynamic> toJson() => _$BaseAppRequestToJson(this);
+}

+ 116 - 0
lib/base/base_request.dart

@@ -0,0 +1,116 @@
+import 'dart:io';
+
+import 'package:electronic_assistant/utils/app_info_util.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+part 'base_request.g.dart';
+
+@JsonSerializable()
+class BaseRequest {
+  /// 平台类型: 1-Android 2-iOS 3-移动H5 4-PC_WEB 5-微信小程序 6-微信小游戏
+  /// 7-微信公众号 8-抖音小程序 9-抖音小游戏 10-鸿蒙APP
+  @JsonKey(name: "appPlatform")
+  late int appPlatform = 0;
+
+  /// 操作系统:android、ios、mac、windows、linux、harmony
+  @JsonKey(name: "os")
+  late String os = "unknown";
+  @JsonKey(name: "osVersion")
+  late String osVersion;
+
+  /// 包信息
+  @JsonKey(name: "packageName")
+  String? packageName;
+  @JsonKey(name: "appVersionName")
+  String? appVersionName;
+  @JsonKey(name: "appVersionCode")
+  int? appVersionCode;
+
+  /// 渠道信息, iOS没有渠道信息, Android通过渠道包工具获取
+  @JsonKey(name: "channelName")
+  String? channelName;
+
+  /// 设备信息
+  /// Android特有
+  @JsonKey(name: "oaid")
+  String? oaid;
+  @JsonKey(name: "aaid")
+  String? aaid;
+  @JsonKey(name: "androidId")
+  String? androidId;
+  @JsonKey(name: "imei")
+  String? imei;
+  @JsonKey(name: "simImei0")
+  String? simImei0;
+  @JsonKey(name: "simImei1")
+  String? simImei1;
+
+  /// iOS特有
+  @JsonKey(name: "idfa")
+  String? idfa;
+  @JsonKey(name: "idfv")
+  String? idfv;
+
+  /// 公共设备信息
+  @JsonKey(name: "machineId")
+  String? machineId;
+  @JsonKey(name: "brand")
+  String? brand;
+  @JsonKey(name: "model")
+  String? model;
+  @JsonKey(name: "mac")
+  String? mac;
+  @JsonKey(name: "wifiName")
+  String? wifiName;
+
+  /// 地理位置信息
+  @JsonKey(name: "region")
+  String? region;
+  @JsonKey(name: "locLng")
+  double? locLng;
+  @JsonKey(name: "locLat")
+  double? locLat;
+
+  BaseRequest() {
+    initPlatformOS();
+    initPackageInfo();
+    initChannelInfo();
+    initDeviceInfo();
+  }
+
+  Map<String, dynamic> toJson() => _$BaseRequestToJson(this);
+
+  void initPlatformOS() {
+    if (Platform.isAndroid) {
+      appPlatform = 1;
+      os = "android";
+    } else if (Platform.isIOS) {
+      appPlatform = 2;
+      os = "ios";
+    } else if (Platform.isMacOS) {
+      os = "mac";
+    } else if (Platform.isWindows) {
+      os = "windows";
+    } else if (Platform.isLinux) {
+      os = "linux";
+    } else if (Platform.isFuchsia) {
+      os = "fuchsia";
+    }
+    osVersion = Platform.operatingSystemVersion;
+
+    debugPrint("os: $os, osVersion: $osVersion");
+  }
+
+  void initPackageInfo() {
+    packageName = appInfoUtil.packageName;
+    appVersionName = appInfoUtil.appVersionName;
+    appVersionCode = appInfoUtil.appVersionCode;
+  }
+
+  void initChannelInfo() {
+    channelName = "";
+  }
+
+  void initDeviceInfo() {}
+}

+ 21 - 0
lib/base/base_response.dart

@@ -0,0 +1,21 @@
+import 'package:json_annotation/json_annotation.dart';
+
+part 'base_response.g.dart';
+
+@JsonSerializable(genericArgumentFactories: true)
+class BaseResponse<T> {
+  @JsonKey(name: 'data')
+  T? data;
+
+  @JsonKey(name: 'code')
+  int? code;
+
+  @JsonKey(name: 'msg')
+  String? message;
+
+  BaseResponse(this.data, this.code, this.message);
+
+  factory BaseResponse.fromJson(
+          Map<String, dynamic> json, T Function(Object? json) fromJsonT) =>
+      _$BaseResponseFromJson(json, fromJsonT);
+}

+ 23 - 0
lib/data/api/atmob_api.dart

@@ -0,0 +1,23 @@
+import 'package:dio/dio.dart';
+import 'package:electronic_assistant/base/base_response.dart';
+import 'package:electronic_assistant/data/api/network_module.dart';
+import 'package:electronic_assistant/data/api/request/login_request.dart';
+import 'package:electronic_assistant/data/api/request/verification_code_request.dart';
+import 'package:electronic_assistant/data/api/response/login_response.dart';
+import 'package:retrofit/http.dart';
+
+part 'atmob_api.g.dart';
+
+@RestApi()
+abstract class AtmobApi {
+  factory AtmobApi(Dio dio, {String baseUrl}) = _AtmobApi;
+
+  @POST("/project/secretary/v1/user/code")
+  Future<void> getVerificationCode(@Body() VerificationCodeRequest request);
+
+  @POST("/project/secretary/v1/user/login")
+  Future<BaseResponse<LoginResponse>> login(@Body() LoginRequest request);
+}
+
+// final atmobApi = AtmobApi(defaultDio, baseUrl: 'https://api.atmob.com');
+final atmobApi = AtmobApi(defaultDio, baseUrl: 'http://192.168.10.171:8880');

+ 101 - 0
lib/data/api/network_module.dart

@@ -0,0 +1,101 @@
+import 'package:dio/dio.dart';
+
+final defaultDio = Dio(BaseOptions(
+
+    /// 发送数据的超时设置。
+    ///
+    /// 超时时会抛出类型为 [DioExceptionType.sendTimeout] 的
+    /// [DioException]。
+    ///
+    /// `null` 或 `Duration.zero` 即不设置超时。
+    //Duration ? sendTimeout;
+
+    /// 接收数据的超时设置。
+    ///
+    /// 这里的超时对应的时间是:
+    ///  - 在建立连接和第一次收到响应数据事件之前的超时。
+    ///  - 每个数据事件传输的间隔时间,而不是接收的总持续时间。
+    ///
+    /// 超时时会抛出类型为 [DioExceptionType.receiveTimeout] 的
+    /// [DioException]。
+    ///
+    /// `null` 或 `Duration.zero` 即不设置超时。
+    //Duration ? receiveTimeout;
+
+    /// 可以在 [Interceptor]、[Transformer] 和
+    /// [Response.requestOptions] 中获取到的自定义对象。
+    //Map<String, dynamic> ? extra;
+
+    /// HTTP 请求头。
+    ///
+    /// 请求头的键是否相等的判断大小写不敏感的。
+    /// 例如:`content-type` 和 `Content-Type` 会视为同样的请求头键。
+    //Map<String, dynamic> ? headers;
+
+    /// 是否保留请求头的大小写。
+    ///
+    /// 默认值为 false。
+    ///
+    /// 该选项在以下场景无效:
+    ///  - XHR 不支持直接处理。
+    ///  - 按照 HTTP/2 的标准,只支持小写请求头键。
+    //bool ? preserveHeaderCase;
+
+    /// 表示 [Dio] 处理请求响应数据的类型。
+    ///
+    /// 默认值为 [ResponseType.json]。
+    /// [Dio] 会在请求响应的 content-type
+    /// 为 [Headers.jsonContentType] 时自动将响应字符串处理为 JSON 对象。
+    ///
+    /// 在以下情况时,分别使用:
+    ///  - `plain` 将数据处理为 `String`;
+    ///  - `bytes` 将数据处理为完整的 bytes。
+    ///  - `stream` 将数据处理为流式返回的二进制数据;
+    //ResponseType? responseType;
+
+    /// 请求的 content-type。
+    ///
+    /// 请求默认的 `content-type` 会由 [ImplyContentTypeInterceptor]
+    /// 根据发送数据的类型推断。它可以通过
+    /// [Interceptors.removeImplyContentTypeInterceptor] 移除。
+    //String? contentType;
+
+    /// 判断当前返回的状态码是否可以视为请求成功。
+    //ValidateStatus? validateStatus;
+
+    /// 是否在请求失败时仍然获取返回数据内容。
+    ///
+    /// 默认为 true。
+    //bool? receiveDataWhenStatusError;
+
+    /// 参考 [HttpClientRequest.followRedirects]。
+    ///
+    /// 默认为 true。
+    //bool? followRedirects;
+
+    /// 当 [followRedirects] 为 true 时,指定的最大重定向次数。
+    /// 如果请求超出了重定向次数上线,会抛出 [RedirectException]。
+    ///
+    /// 默认为 5。
+    //int? maxRedirects;
+
+    /// 参考 [HttpClientRequest.persistentConnection]。
+    ///
+    /// 默认为 true。
+    //bool? persistentConnection;
+
+    /// 对请求内容进行自定义编码转换。
+    ///
+    /// 默认为 [Utf8Encoder]。
+    //RequestEncoder? requestEncoder;
+
+    /// 对请求响应内容进行自定义解码转换。
+    ///
+    /// 默认为 [Utf8Decoder]。
+    //ResponseDecoder? responseDecoder;
+
+    /// 当请求参数以 `x-www-url-encoded` 方式发送时,如何处理集合参数。
+    ///
+    /// 默认为 [ListFormat.multi]。
+    //ListFormat? listFormat;
+    ));

+ 18 - 0
lib/data/api/request/login_request.dart

@@ -0,0 +1,18 @@
+import 'package:electronic_assistant/base/base_request.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+part 'login_request.g.dart';
+
+@JsonSerializable()
+class LoginRequest extends BaseRequest {
+  @JsonKey(name: "phone")
+  late String phone;
+
+  @JsonKey(name: "code")
+  late String code;
+
+  LoginRequest(this.phone, this.code);
+
+  @override
+  Map<String, dynamic> toJson() => _$LoginRequestToJson(this);
+}

+ 15 - 0
lib/data/api/request/verification_code_request.dart

@@ -0,0 +1,15 @@
+import 'package:electronic_assistant/base/base_request.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+part 'verification_code_request.g.dart';
+
+@JsonSerializable()
+class VerificationCodeRequest extends BaseRequest {
+  @JsonKey(name: "phone")
+  late String phone;
+
+  VerificationCodeRequest(this.phone);
+
+  @override
+  Map<String, dynamic> toJson() => _$VerificationCodeRequestToJson(this);
+}

+ 16 - 0
lib/data/api/response/login_response.dart

@@ -0,0 +1,16 @@
+import 'package:json_annotation/json_annotation.dart';
+
+part 'login_response.g.dart';
+
+@JsonSerializable()
+class LoginResponse {
+  @JsonKey(name: "authToken")
+  String? authToken;
+
+  @JsonKey(name: "newReg")
+  bool? newcomer;
+
+  LoginResponse(this.authToken, this.newcomer);
+
+  factory LoginResponse.fromJson(Map<String, dynamic> json) => _$LoginResponseFromJson(json);
+}

+ 17 - 1
lib/main.dart

@@ -1,7 +1,23 @@
+import 'package:electronic_assistant/data/api/atmob_api.dart';
+import 'package:electronic_assistant/data/api/request/verification_code_request.dart';
+import 'package:electronic_assistant/utils/app_info_util.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
 
 
-void main() {
+Future<void> main() async {
+  WidgetsFlutterBinding.ensureInitialized();
+
+  await appInfoUtil.init();
+
   runApp(const MyApp());
   runApp(const MyApp());
+
+  debugPrint("getVerificationCode start");
+  atmobApi
+      .getVerificationCode(VerificationCodeRequest("17674103210"))
+      .then((void value) {
+    debugPrint("getVerificationCode success");
+  }).catchError((Object error) {
+    debugPrint("getVerificationCode error: $error");
+  });
 }
 }
 
 
 class MyApp extends StatelessWidget {
 class MyApp extends StatelessWidget {

+ 21 - 0
lib/utils/app_info_util.dart

@@ -0,0 +1,21 @@
+import 'package:package_info/package_info.dart';
+
+class AppInfoUtil {
+  PackageInfo? _packageInfo;
+
+  AppInfoUtil._();
+
+  init() async {
+    _packageInfo = await PackageInfo.fromPlatform();
+  }
+
+  String? get appName => _packageInfo?.appName;
+
+  String? get packageName => _packageInfo?.packageName;
+
+  String? get appVersionName => _packageInfo?.version;
+
+  int? get appVersionCode => int.tryParse(_packageInfo?.buildNumber ?? '');
+}
+
+final appInfoUtil = AppInfoUtil._();

+ 1 - 0
lib/utils/device_info_util.dart

@@ -0,0 +1 @@
+class DeviceInfo {}

+ 424 - 0
pubspec.lock

@@ -1,6 +1,30 @@
 # Generated by pub
 # Generated by pub
 # See https://dart.dev/tools/pub/glossary#lockfile
 # See https://dart.dev/tools/pub/glossary#lockfile
 packages:
 packages:
+  _fe_analyzer_shared:
+    dependency: transitive
+    description:
+      name: _fe_analyzer_shared
+      sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7"
+      url: "https://pub.dev"
+    source: hosted
+    version: "67.0.0"
+  analyzer:
+    dependency: transitive
+    description:
+      name: analyzer
+      sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d"
+      url: "https://pub.dev"
+    source: hosted
+    version: "6.4.1"
+  args:
+    dependency: transitive
+    description:
+      name: args
+      sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a"
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.5.0"
   async:
   async:
     dependency: transitive
     dependency: transitive
     description:
     description:
@@ -17,6 +41,70 @@ packages:
       url: "https://pub.dev"
       url: "https://pub.dev"
     source: hosted
     source: hosted
     version: "2.1.1"
     version: "2.1.1"
+  build:
+    dependency: transitive
+    description:
+      name: build
+      sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0"
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.4.1"
+  build_config:
+    dependency: transitive
+    description:
+      name: build_config
+      sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.1.1"
+  build_daemon:
+    dependency: transitive
+    description:
+      name: build_daemon
+      sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9"
+      url: "https://pub.dev"
+    source: hosted
+    version: "4.0.2"
+  build_resolvers:
+    dependency: transitive
+    description:
+      name: build_resolvers
+      sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a"
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.4.2"
+  build_runner:
+    dependency: "direct dev"
+    description:
+      name: build_runner
+      sha256: "644dc98a0f179b872f612d3eb627924b578897c629788e858157fa5e704ca0c7"
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.4.11"
+  build_runner_core:
+    dependency: transitive
+    description:
+      name: build_runner_core
+      sha256: e3c79f69a64bdfcd8a776a3c28db4eb6e3fb5356d013ae5eb2e52007706d5dbe
+      url: "https://pub.dev"
+    source: hosted
+    version: "7.3.1"
+  built_collection:
+    dependency: transitive
+    description:
+      name: built_collection
+      sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100"
+      url: "https://pub.dev"
+    source: hosted
+    version: "5.1.1"
+  built_value:
+    dependency: transitive
+    description:
+      name: built_value
+      sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb
+      url: "https://pub.dev"
+    source: hosted
+    version: "8.9.2"
   characters:
   characters:
     dependency: transitive
     dependency: transitive
     description:
     description:
@@ -25,6 +113,14 @@ packages:
       url: "https://pub.dev"
       url: "https://pub.dev"
     source: hosted
     source: hosted
     version: "1.3.0"
     version: "1.3.0"
+  checked_yaml:
+    dependency: transitive
+    description:
+      name: checked_yaml
+      sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.0.3"
   clock:
   clock:
     dependency: transitive
     dependency: transitive
     description:
     description:
@@ -33,6 +129,14 @@ packages:
       url: "https://pub.dev"
       url: "https://pub.dev"
     source: hosted
     source: hosted
     version: "1.1.1"
     version: "1.1.1"
+  code_builder:
+    dependency: transitive
+    description:
+      name: code_builder
+      sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37
+      url: "https://pub.dev"
+    source: hosted
+    version: "4.10.0"
   collection:
   collection:
     dependency: transitive
     dependency: transitive
     description:
     description:
@@ -41,6 +145,22 @@ packages:
       url: "https://pub.dev"
       url: "https://pub.dev"
     source: hosted
     source: hosted
     version: "1.18.0"
     version: "1.18.0"
+  convert:
+    dependency: transitive
+    description:
+      name: convert
+      sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592"
+      url: "https://pub.dev"
+    source: hosted
+    version: "3.1.1"
+  crypto:
+    dependency: transitive
+    description:
+      name: crypto
+      sha256: "1dceb0cf05cb63a7852c11560060e53ec2f182079a16ced6f4395c5b0875baf8"
+      url: "https://pub.dev"
+    source: hosted
+    version: "3.0.4"
   cupertino_icons:
   cupertino_icons:
     dependency: "direct main"
     dependency: "direct main"
     description:
     description:
@@ -49,6 +169,30 @@ packages:
       url: "https://pub.dev"
       url: "https://pub.dev"
     source: hosted
     source: hosted
     version: "1.0.8"
     version: "1.0.8"
+  dart_style:
+    dependency: transitive
+    description:
+      name: dart_style
+      sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9"
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.3.6"
+  dio:
+    dependency: "direct main"
+    description:
+      name: dio
+      sha256: "0dfb6b6a1979dac1c1245e17cef824d7b452ea29bd33d3467269f9bef3715fb0"
+      url: "https://pub.dev"
+    source: hosted
+    version: "5.6.0"
+  dio_web_adapter:
+    dependency: transitive
+    description:
+      name: dio_web_adapter
+      sha256: "33259a9276d6cea88774a0000cfae0d861003497755969c92faa223108620dc8"
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.0.0"
   fake_async:
   fake_async:
     dependency: transitive
     dependency: transitive
     description:
     description:
@@ -57,6 +201,22 @@ packages:
       url: "https://pub.dev"
       url: "https://pub.dev"
     source: hosted
     source: hosted
     version: "1.3.1"
     version: "1.3.1"
+  file:
+    dependency: transitive
+    description:
+      name: file
+      sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
+      url: "https://pub.dev"
+    source: hosted
+    version: "7.0.0"
+  fixnum:
+    dependency: transitive
+    description:
+      name: fixnum
+      sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.1.0"
   flutter:
   flutter:
     dependency: "direct main"
     dependency: "direct main"
     description: flutter
     description: flutter
@@ -75,6 +235,86 @@ packages:
     description: flutter
     description: flutter
     source: sdk
     source: sdk
     version: "0.0.0"
     version: "0.0.0"
+  frontend_server_client:
+    dependency: transitive
+    description:
+      name: frontend_server_client
+      sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694
+      url: "https://pub.dev"
+    source: hosted
+    version: "4.0.0"
+  get:
+    dependency: "direct main"
+    description:
+      name: get
+      sha256: e4e7335ede17452b391ed3b2ede016545706c01a02292a6c97619705e7d2a85e
+      url: "https://pub.dev"
+    source: hosted
+    version: "4.6.6"
+  glob:
+    dependency: transitive
+    description:
+      name: glob
+      sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63"
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.1.2"
+  graphs:
+    dependency: transitive
+    description:
+      name: graphs
+      sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0"
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.3.2"
+  http_multi_server:
+    dependency: transitive
+    description:
+      name: http_multi_server
+      sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b"
+      url: "https://pub.dev"
+    source: hosted
+    version: "3.2.1"
+  http_parser:
+    dependency: transitive
+    description:
+      name: http_parser
+      sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
+      url: "https://pub.dev"
+    source: hosted
+    version: "4.0.2"
+  io:
+    dependency: transitive
+    description:
+      name: io
+      sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e"
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.0.4"
+  js:
+    dependency: transitive
+    description:
+      name: js
+      sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf
+      url: "https://pub.dev"
+    source: hosted
+    version: "0.7.1"
+  json_annotation:
+    dependency: "direct main"
+    description:
+      name: json_annotation
+      sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
+      url: "https://pub.dev"
+    source: hosted
+    version: "4.9.0"
+  json_serializable:
+    dependency: "direct dev"
+    description:
+      name: json_serializable
+      sha256: ea1432d167339ea9b5bb153f0571d0039607a873d6e04e0117af043f14a1fd4b
+      url: "https://pub.dev"
+    source: hosted
+    version: "6.8.0"
   leak_tracker:
   leak_tracker:
     dependency: transitive
     dependency: transitive
     description:
     description:
@@ -107,6 +347,22 @@ packages:
       url: "https://pub.dev"
       url: "https://pub.dev"
     source: hosted
     source: hosted
     version: "3.0.0"
     version: "3.0.0"
+  logger:
+    dependency: "direct main"
+    description:
+      name: logger
+      sha256: "697d067c60c20999686a0add96cf6aba723b3aa1f83ecf806a8097231529ec32"
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.4.0"
+  logging:
+    dependency: transitive
+    description:
+      name: logging
+      sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.2.0"
   matcher:
   matcher:
     dependency: transitive
     dependency: transitive
     description:
     description:
@@ -131,6 +387,30 @@ packages:
       url: "https://pub.dev"
       url: "https://pub.dev"
     source: hosted
     source: hosted
     version: "1.12.0"
     version: "1.12.0"
+  mime:
+    dependency: transitive
+    description:
+      name: mime
+      sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2"
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.0.5"
+  package_config:
+    dependency: transitive
+    description:
+      name: package_config
+      sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd"
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.1.0"
+  package_info:
+    dependency: "direct main"
+    description:
+      name: package_info
+      sha256: "6c07d9d82c69e16afeeeeb6866fe43985a20b3b50df243091bfc4a4ad2b03b75"
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.0.2"
   path:
   path:
     dependency: transitive
     dependency: transitive
     description:
     description:
@@ -139,11 +419,83 @@ packages:
       url: "https://pub.dev"
       url: "https://pub.dev"
     source: hosted
     source: hosted
     version: "1.9.0"
     version: "1.9.0"
+  pool:
+    dependency: transitive
+    description:
+      name: pool
+      sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a"
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.5.1"
+  pub_semver:
+    dependency: transitive
+    description:
+      name: pub_semver
+      sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c"
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.1.4"
+  pubspec_parse:
+    dependency: transitive
+    description:
+      name: pubspec_parse
+      sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.3.0"
+  retrofit:
+    dependency: "direct main"
+    description:
+      name: retrofit
+      sha256: "1fceca35cc68d5f14ff70ae830acbf157263b42e1cdfd5b38045ca517535b734"
+      url: "https://pub.dev"
+    source: hosted
+    version: "4.2.0"
+  retrofit_generator:
+    dependency: "direct dev"
+    description:
+      name: retrofit_generator
+      sha256: "9499eb46b3657a62192ddbc208ff7e6c6b768b19e83c1ee6f6b119c864b99690"
+      url: "https://pub.dev"
+    source: hosted
+    version: "7.0.8"
+  shelf:
+    dependency: transitive
+    description:
+      name: shelf
+      sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.4.1"
+  shelf_web_socket:
+    dependency: transitive
+    description:
+      name: shelf_web_socket
+      sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611"
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.0.0"
   sky_engine:
   sky_engine:
     dependency: transitive
     dependency: transitive
     description: flutter
     description: flutter
     source: sdk
     source: sdk
     version: "0.0.99"
     version: "0.0.99"
+  source_gen:
+    dependency: transitive
+    description:
+      name: source_gen
+      sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832"
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.5.0"
+  source_helper:
+    dependency: transitive
+    description:
+      name: source_helper
+      sha256: "6adebc0006c37dd63fe05bca0a929b99f06402fc95aa35bf36d67f5c06de01fd"
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.3.4"
   source_span:
   source_span:
     dependency: transitive
     dependency: transitive
     description:
     description:
@@ -168,6 +520,14 @@ packages:
       url: "https://pub.dev"
       url: "https://pub.dev"
     source: hosted
     source: hosted
     version: "2.1.2"
     version: "2.1.2"
+  stream_transform:
+    dependency: transitive
+    description:
+      name: stream_transform
+      sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f"
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.1.0"
   string_scanner:
   string_scanner:
     dependency: transitive
     dependency: transitive
     description:
     description:
@@ -192,6 +552,30 @@ packages:
       url: "https://pub.dev"
       url: "https://pub.dev"
     source: hosted
     source: hosted
     version: "0.7.0"
     version: "0.7.0"
+  timing:
+    dependency: transitive
+    description:
+      name: timing
+      sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32"
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.0.1"
+  tuple:
+    dependency: transitive
+    description:
+      name: tuple
+      sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151
+      url: "https://pub.dev"
+    source: hosted
+    version: "2.0.2"
+  typed_data:
+    dependency: transitive
+    description:
+      name: typed_data
+      sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.3.2"
   vector_math:
   vector_math:
     dependency: transitive
     dependency: transitive
     description:
     description:
@@ -208,6 +592,46 @@ packages:
       url: "https://pub.dev"
       url: "https://pub.dev"
     source: hosted
     source: hosted
     version: "14.2.1"
     version: "14.2.1"
+  watcher:
+    dependency: transitive
+    description:
+      name: watcher
+      sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8"
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.1.0"
+  web:
+    dependency: transitive
+    description:
+      name: web
+      sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062
+      url: "https://pub.dev"
+    source: hosted
+    version: "1.0.0"
+  web_socket:
+    dependency: transitive
+    description:
+      name: web_socket
+      sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83"
+      url: "https://pub.dev"
+    source: hosted
+    version: "0.1.6"
+  web_socket_channel:
+    dependency: transitive
+    description:
+      name: web_socket_channel
+      sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f"
+      url: "https://pub.dev"
+    source: hosted
+    version: "3.0.1"
+  yaml:
+    dependency: transitive
+    description:
+      name: yaml
+      sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
+      url: "https://pub.dev"
+    source: hosted
+    version: "3.1.2"
 sdks:
 sdks:
   dart: ">=3.4.3 <4.0.0"
   dart: ">=3.4.3 <4.0.0"
   flutter: ">=3.18.0-18.0.pre.54"
   flutter: ">=3.18.0-18.0.pre.54"

+ 16 - 0
pubspec.yaml

@@ -36,6 +36,18 @@ dependencies:
   # Use with the CupertinoIcons class for iOS style icons.
   # Use with the CupertinoIcons class for iOS style icons.
   cupertino_icons: ^1.0.6
   cupertino_icons: ^1.0.6
 
 
+  # 状态管理
+  get: ^4.6.6
+
+  # 网络请求
+  dio: ^5.6.0
+  retrofit: '>=4.0.0 <5.0.0'
+  logger: any
+  json_annotation: ^4.8.1
+
+  # 包信息
+  package_info: ^2.0.2
+
 dev_dependencies:
 dev_dependencies:
   flutter_test:
   flutter_test:
     sdk: flutter
     sdk: flutter
@@ -47,6 +59,10 @@ dev_dependencies:
   # rules and activating additional ones.
   # rules and activating additional ones.
   flutter_lints: ^3.0.0
   flutter_lints: ^3.0.0
 
 
+  retrofit_generator: '>=7.0.0 <8.0.0'
+  build_runner: '>=2.3.0 <4.0.0'
+  json_serializable: ^6.6.2
+
 # For information on the generic Dart part of this file, see the
 # For information on the generic Dart part of this file, see the
 # following page: https://dart.dev/tools/pub/pubspec
 # following page: https://dart.dev/tools/pub/pubspec