zhaoyadi пре 4 година
родитељ
комит
37e94b3067

+ 1 - 1
example/.flutter-plugins-dependencies

@@ -1 +1 @@
-{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"image_picker","path":"C:\\\\Users\\\\pc\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\image_picker-0.6.7+12\\\\","dependencies":[]},{"name":"sy_flutter_qiniu_storage","path":"D:\\\\flutter_plugins\\\\sy_flutter_qiniu_storage-master\\\\","dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\Users\\\\pc\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\flutter_plugin_android_lifecycle-1.0.11\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\Users\\\\pc\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\image_picker-0.6.7+12\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"sy_flutter_qiniu_storage","path":"D:\\\\flutter_plugins\\\\sy_flutter_qiniu_storage-master\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"sy_flutter_qiniu_storage","dependencies":[]}],"date_created":"2020-10-16 11:28:12.728857","version":"1.22.1"}
+{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"image_picker","path":"C:\\\\Users\\\\zhaoyadi\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\image_picker-0.6.7+22\\\\","dependencies":[]},{"name":"sy_flutter_qiniu_storage","path":"D:\\\\code\\\\sy_flutter_qiniu_storage\\\\","dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\Users\\\\zhaoyadi\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\flutter_plugin_android_lifecycle-1.0.11\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\Users\\\\zhaoyadi\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.flutter-io.cn\\\\image_picker-0.6.7+22\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"sy_flutter_qiniu_storage","path":"D:\\\\code\\\\sy_flutter_qiniu_storage\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"sy_flutter_qiniu_storage","dependencies":[]}],"date_created":"2021-03-09 18:32:14.167218","version":"2.0.1"}

+ 2 - 4
example/ios/Flutter/flutter_export_environment.sh

@@ -1,12 +1,10 @@
 #!/bin/sh
 # This is a generated file; do not edit or check into version control.
-export "FLUTTER_ROOT=D:\flutter"
-export "FLUTTER_APPLICATION_PATH=D:\flutter_plugins\sy_flutter_qiniu_storage-master\example"
+export "FLUTTER_ROOT=D:\sdk\flutter"
+export "FLUTTER_APPLICATION_PATH=D:\code\sy_flutter_qiniu_storage\example"
 export "FLUTTER_TARGET=lib\main.dart"
 export "FLUTTER_BUILD_DIR=build"
 export "SYMROOT=${SOURCE_ROOT}/../build\ios"
-export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
-export "FLUTTER_FRAMEWORK_DIR=D:\flutter\bin\cache\artifacts\engine\ios"
 export "FLUTTER_BUILD_NAME=1.0.0"
 export "FLUTTER_BUILD_NUMBER=1"
 export "DART_OBFUSCATION=false"

+ 9 - 12
lib/sy_flutter_qiniu_storage.dart

@@ -6,14 +6,12 @@ import 'package:flutter/services.dart';
 typedef onData = void Function(dynamic event);
 
 class SyFlutterQiniuStorage {
-  static const MethodChannel _channel =
-      const MethodChannel('sy_flutter_qiniu_storage');
-  static const EventChannel _eventChannel =
-      const EventChannel('sy_flutter_qiniu_storage_event');
+  static const MethodChannel _channel = const MethodChannel('sy_flutter_qiniu_storage');
+  static const EventChannel _eventChannel = const EventChannel('sy_flutter_qiniu_storage_event');
 
-  Stream _onChanged;
+  Stream? _onChanged;
 
-  Stream onChanged() {
+  Stream? onChanged() {
     if (_onChanged == null) {
       _onChanged = _eventChannel.receiveBroadcastStream();
     }
@@ -24,8 +22,7 @@ class SyFlutterQiniuStorage {
   ///
   /// key 保存到七牛的文件名
   Future<UploadResult> upload(String filepath, String token, String key) async {
-    var res = await _channel.invokeMethod('upload',
-        <String, String>{"filepath": filepath, "token": token, "key": key});
+    var res = await _channel.invokeMethod('upload', <String, String>{"filepath": filepath, "token": token, "key": key});
 
     return UploadResult.fromJson(json.decode(res));
   }
@@ -39,17 +36,17 @@ class SyFlutterQiniuStorage {
 //上传结果
 class UploadResult {
   //是否成功
-  bool success;
+  late final bool success;
 
   //错误信息
-  String error;
+  String? error;
 
   //客户端指定的key
-  String key;
+  String? key;
 
   //上传成功后,自定义七牛云最终返回給上传端的数据
   //七牛上传策略 https://developer.qiniu.com/kodo/manual/1206/put-policy
-  Map<String, dynamic> result;
+  Map<String, dynamic>? result;
 
   UploadResult.fromJson(Map<String, dynamic> json) {
     success = json['success'] ?? false;

+ 2 - 37
pubspec.yaml

@@ -1,52 +1,17 @@
 name: sy_flutter_qiniu_storage
 description: A Flutter plugin for integrating Qiniu file upload in iOS and Android applications.
   七牛文件上传
-version: 0.2.1
-homepage: https://github.com/lishuhao/sy_flutter_qiniu_storage
+# version: 0.2.1
 
 environment:
-  sdk: ">=2.1.0 <3.0.0"
+  sdk: '>=2.12.0 <3.0.0'
 
 dependencies:
   flutter:
     sdk: flutter
 
-# For information on the generic Dart part of this file, see the
-# following page: https://www.dartlang.org/tools/pub/pubspec
-
-# The following section is specific to Flutter.
 flutter:
   plugin:
     androidPackage: plugin.storage.qiniu.flutter.isanye.cn.syflutterqiniustorage
     pluginClass: SyFlutterQiniuStoragePlugin
 
-  # To add assets to your plugin package, add an assets section, like this:
-  # assets:
-  #  - images/a_dot_burr.jpeg
-  #  - images/a_dot_ham.jpeg
-  #
-  # For details regarding assets in packages, see
-  # https://flutter.io/assets-and-images/#from-packages
-  #
-  # An image asset can refer to one or more resolution-specific "variants", see
-  # https://flutter.io/assets-and-images/#resolution-aware.
-
-  # To add custom fonts to your plugin package, add a fonts section here,
-  # in this "flutter" section. Each entry in this list should have a
-  # "family" key with the font family name, and a "fonts" key with a
-  # list giving the asset and other descriptors for the font. For
-  # example:
-  # fonts:
-  #   - family: Schyler
-  #     fonts:
-  #       - asset: fonts/Schyler-Regular.ttf
-  #       - asset: fonts/Schyler-Italic.ttf
-  #         style: italic
-  #   - family: Trajan Pro
-  #     fonts:
-  #       - asset: fonts/TrajanPro.ttf
-  #       - asset: fonts/TrajanPro_Bold.ttf
-  #         weight: 700
-  #
-  # For details regarding fonts in packages, see
-  # https://flutter.io/custom-fonts/#from-packages