Преглед на файлове

Merge branch 'master' of https://git.luojigou.vip/luojigou_app/r_scan

# Conflicts:
#	example/.flutter-plugins-dependencies
zhanghengSmallTechnology преди 4 години
родител
ревизия
a390368922
променени са 6 файла, в които са добавени 246 реда и са изтрити 288 реда
  1. 21 21
      example/pubspec.lock
  2. 15 18
      lib/r_scan.dart
  3. 47 51
      lib/src/r_scan_camera.dart
  4. 138 138
      lib/src/r_scan_view.dart
  5. 20 19
      pubspec.lock
  6. 5 41
      pubspec.yaml

+ 21 - 21
example/pubspec.lock

@@ -7,42 +7,42 @@ packages:
       name: async
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "2.5.0-nullsafety.1"
+    version: "2.5.0"
   boolean_selector:
     dependency: transitive
     description:
       name: boolean_selector
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "2.1.0-nullsafety.1"
+    version: "2.1.0"
   characters:
     dependency: transitive
     description:
       name: characters
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.1.0-nullsafety.3"
+    version: "1.1.0"
   charcode:
     dependency: transitive
     description:
       name: charcode
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.2.0-nullsafety.1"
+    version: "1.2.0"
   clock:
     dependency: transitive
     description:
       name: clock
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.1.0-nullsafety.1"
+    version: "1.1.0"
   collection:
     dependency: transitive
     description:
       name: collection
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.15.0-nullsafety.3"
+    version: "1.15.0"
   cupertino_icons:
     dependency: "direct main"
     description:
@@ -56,7 +56,7 @@ packages:
       name: fake_async
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.2.0-nullsafety.1"
+    version: "1.2.0"
   flutter:
     dependency: "direct main"
     description: flutter
@@ -108,21 +108,21 @@ packages:
       name: matcher
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "0.12.10-nullsafety.1"
+    version: "0.12.10"
   meta:
     dependency: transitive
     description:
       name: meta
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.3.0-nullsafety.3"
+    version: "1.3.0"
   path:
     dependency: transitive
     description:
       name: path
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.8.0-nullsafety.1"
+    version: "1.8.0"
   pedantic:
     dependency: transitive
     description:
@@ -150,7 +150,7 @@ packages:
       path: ".."
       relative: true
     source: path
-    version: "0.1.4+1"
+    version: "1.0.0-nullsafety"
   sky_engine:
     dependency: transitive
     description: flutter
@@ -162,56 +162,56 @@ packages:
       name: source_span
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.8.0-nullsafety.2"
+    version: "1.8.0"
   stack_trace:
     dependency: transitive
     description:
       name: stack_trace
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.10.0-nullsafety.1"
+    version: "1.10.0"
   stream_channel:
     dependency: transitive
     description:
       name: stream_channel
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "2.1.0-nullsafety.1"
+    version: "2.1.0"
   string_scanner:
     dependency: transitive
     description:
       name: string_scanner
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.1.0-nullsafety.1"
+    version: "1.1.0"
   term_glyph:
     dependency: transitive
     description:
       name: term_glyph
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.2.0-nullsafety.1"
+    version: "1.2.0"
   test_api:
     dependency: transitive
     description:
       name: test_api
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "0.2.19-nullsafety.2"
+    version: "0.2.19"
   typed_data:
     dependency: transitive
     description:
       name: typed_data
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.3.0-nullsafety.3"
+    version: "1.3.0"
   vector_math:
     dependency: transitive
     description:
       name: vector_math
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "2.1.0-nullsafety.3"
+    version: "2.1.0"
 sdks:
-  dart: ">=2.10.0-110 <2.11.0"
-  flutter: ">=1.12.13 <2.0.0"
+  dart: ">=2.12.0 <3.0.0"
+  flutter: ">=2.0.0"

+ 15 - 18
lib/r_scan.dart

@@ -10,15 +10,14 @@ export 'package:r_scan/src/r_scan_camera.dart';
 
 /// qr scan
 class RScan {
-  static const MethodChannel _channel =
-      const MethodChannel('com.rhyme_lph/r_scan');
+  static const MethodChannel _channel = const MethodChannel('com.rhyme_lph/r_scan');
 
   /// scan qr image in path
   ///
   /// [path] your qr image path
   ///
   /// It will return your scan result.if not found qr,will return empty.
-  static Future<RScanResult> scanImagePath(String path) async =>
+  static Future<RScanResult?> scanImagePath(String path) async =>
       RScanResult.formMap(await _channel.invokeMethod('scanImagePath', {
         "path": path,
       }));
@@ -28,7 +27,7 @@ class RScan {
   /// [url] your qr image url
   ///
   /// It will return your scan result.if not found qr,will return empty.
-  static Future<RScanResult> scanImageUrl(String url) async =>
+  static Future<RScanResult?> scanImageUrl(String url) async =>
       RScanResult.formMap(await _channel.invokeMethod('scanImageUrl', {
         "url": url,
       }));
@@ -38,7 +37,7 @@ class RScan {
   /// [uint8list] your qr image memory
   ///
   /// It will return your scan result.if not found qr,will return empty.
-  static Future<RScanResult> scanImageMemory(Uint8List uint8list) async =>
+  static Future<RScanResult?> scanImageMemory(Uint8List uint8list) async =>
       RScanResult.formMap(await _channel.invokeMethod('scanImageMemory', {
         "uint8list": uint8list,
       }));
@@ -82,11 +81,7 @@ class RScanPoint {
 
   @override
   bool operator ==(Object other) =>
-      identical(this, other) ||
-      other is RScanPoint &&
-          runtimeType == other.runtimeType &&
-          x == other.x &&
-          y == other.y;
+      identical(this, other) || other is RScanPoint && runtimeType == other.runtimeType && x == other.x && y == other.y;
 
   @override
   int get hashCode => x.hashCode ^ y.hashCode;
@@ -95,23 +90,25 @@ class RScanPoint {
 /// scan result
 class RScanResult {
   /// barcode type
-  final RScanBarType type;
+  final RScanBarType? type;
 
   ///barcode message
-  final String message;
+  final String? message;
 
   ///barcode points
-  final List<RScanPoint> points;
+  final List<RScanPoint>? points;
 
-  const RScanResult({this.type, this.message, this.points});
+  const RScanResult({
+    this.type,
+    this.message,
+    this.points,
+  });
 
-  factory RScanResult.formMap(Map map) {
+  static RScanResult? formMap(Map? map) {
     return map == null
         ? null
         : RScanResult(
-            type: map['type'] != null
-                ? RScanBarType.values[map['type'] as int]
-                : null,
+            type: map['type'] != null ? RScanBarType.values[map['type'] as int] : null,
             message: map['message'] as String,
             points: map['points'] != null
                 ? (map['points'] as List)

+ 47 - 51
lib/src/r_scan_camera.dart

@@ -10,11 +10,11 @@ import 'package:r_scan/r_scan.dart';
 const _scanType = 'com.rhyme_lph/r_scan_camera';
 final MethodChannel _channel = const MethodChannel('$_scanType/method');
 
-Future<List<RScanCameraDescription>> availableRScanCameras() async {
+Future<List<RScanCameraDescription>?> availableRScanCameras() async {
   try {
-    final List<Map<dynamic, dynamic>> cameras = await _channel
-        .invokeListMethod<Map<dynamic, dynamic>>('availableCameras');
-    return cameras.map((Map<dynamic, dynamic> camera) {
+    final List<Map<dynamic, dynamic>>? cameras =
+        await _channel.invokeListMethod<Map<dynamic, dynamic>>('availableCameras');
+    return cameras?.map((camera) {
       return RScanCameraDescription(
         name: camera['name'],
         lensDirection: _parseCameraLensDirection(camera['lensFacing']),
@@ -28,14 +28,16 @@ Future<List<RScanCameraDescription>> availableRScanCameras() async {
 class RScanCameraController extends ValueNotifier<RScanCameraValue> {
   final RScanCameraDescription description;
   final RScanCameraResolutionPreset resolutionPreset;
-  RScanResult result; // qr code result
-  int _textureId; // init finish will return id
+  RScanResult? result; // qr code result
+  late int _textureId; // init finish will return id
   bool _isDisposed = false; // when the widget dispose will set true
-  Completer<void> _creatingCompleter; // when the camera create finish
-  StreamSubscription<dynamic> _resultSubscription; //the result subscription
+  late Completer<void> _creatingCompleter; // when the camera create finish
+  StreamSubscription<dynamic>? _resultSubscription; //the result subscription
 
-  RScanCameraController(this.description, this.resolutionPreset)
-      : super(const RScanCameraValue.uninitialized());
+  RScanCameraController(
+    this.description,
+    this.resolutionPreset,
+  ) : super(const RScanCameraValue.uninitialized());
 
   Future<void> initialize() async {
     if (_isDisposed) return Future<void>.value();
@@ -43,19 +45,17 @@ class RScanCameraController extends ValueNotifier<RScanCameraValue> {
     _creatingCompleter = Completer<void>();
 
     try {
-      final Map<String, dynamic> reply =
-          await _channel.invokeMapMethod('initialize', <String, dynamic>{
+      final Map<String, dynamic> reply = (await _channel.invokeMapMethod('initialize', <String, dynamic>{
         'cameraName': description.name,
         'resolutionPreset': _serializeResolutionPreset(resolutionPreset),
-      });
+      }))!;
       _textureId = reply['textureId'];
       value = value.copyWith(
-          isInitialized: true,
-          previewSize: Size(reply['previewWidth'].toDouble(),
-              reply['previewHeight'].toDouble()));
-      _resultSubscription = EventChannel('${_scanType}_$_textureId/event')
-          .receiveBroadcastStream()
-          .listen(_handleResult);
+        isInitialized: true,
+        previewSize: Size(reply['previewWidth'].toDouble(), reply['previewHeight'].toDouble()),
+      );
+      _resultSubscription =
+          EventChannel('${_scanType}_$_textureId/event').receiveBroadcastStream().listen(_handleResult);
     } on PlatformException catch (e) {
       //当发生权限问题的异常时会抛出
       throw RScanCameraException(e.code, e.message);
@@ -86,8 +86,7 @@ class RScanCameraController extends ValueNotifier<RScanCameraValue> {
   /// [isOpen] if false will close flash mode.
   ///
   /// It will return is success.
-  Future<bool> setFlashMode(bool isOpen) async =>
-      await _channel.invokeMethod('setFlashMode', {
+  Future<bool> setFlashMode(bool isOpen) async => await _channel.invokeMethod('setFlashMode', {
         'isOpen': isOpen,
       });
 
@@ -96,14 +95,12 @@ class RScanCameraController extends ValueNotifier<RScanCameraValue> {
   /// [isOpen] if false will close flash mode.
   ///
   /// It will return is success.
-  Future<bool> getFlashMode() async =>
-      await _channel.invokeMethod('getFlashMode');
+  Future<bool> getFlashMode() async => await _channel.invokeMethod('getFlashMode');
 
   /// flash auto open when brightness value less then 600.
   ///
   /// [isAuto] auto
-  Future<bool> setAutoFlashMode(bool isAuto) async =>
-      await _channel.invokeMethod('setAutoFlashMode', {
+  Future<bool> setAutoFlashMode(bool isAuto) async => await _channel.invokeMethod('setAutoFlashMode', {
         'isAuto': isAuto,
       });
 
@@ -127,25 +124,25 @@ class RScanCameraController extends ValueNotifier<RScanCameraValue> {
 /// camera value info
 class RScanCameraValue {
   final bool isInitialized;
-  final String errorDescription;
-  final Size previewSize;
+  final String? errorDescription;
+  final Size? previewSize;
 
-  const RScanCameraValue(
-      {this.isInitialized, this.errorDescription, this.previewSize});
+  const RScanCameraValue({
+    required this.isInitialized,
+    this.errorDescription,
+    this.previewSize,
+  });
 
-  const RScanCameraValue.uninitialized()
-      : this(
-          isInitialized: false,
-        );
+  const RScanCameraValue.uninitialized() : this(isInitialized: false);
 
-  double get aspectRatio => previewSize.height / previewSize.width;
+  double get aspectRatio => previewSize!.height / previewSize!.width;
 
   bool get hasError => errorDescription != null;
 
   RScanCameraValue copyWith({
-    bool isInitialized,
-    String errorDescription,
-    Size previewSize,
+    bool? isInitialized,
+    String? errorDescription,
+    Size? previewSize,
   }) {
     return RScanCameraValue(
       isInitialized: isInitialized ?? this.isInitialized,
@@ -166,21 +163,19 @@ class RScanCameraValue {
 class RScanCamera extends StatelessWidget {
   final RScanCameraController controller;
 
-  const RScanCamera(this.controller, {Key key}) : super(key: key);
+  const RScanCamera(this.controller, {Key? key}) : super(key: key);
 
   @override
   Widget build(BuildContext context) {
-    return controller.value.isInitialized
-        ? Texture(textureId: controller._textureId)
-        : Container();
+    return controller.value.isInitialized ? Texture(textureId: controller._textureId) : Container();
   }
 }
 
 /// camera description
 class RScanCameraDescription {
   RScanCameraDescription({
-    this.name,
-    this.lensDirection,
+    required this.name,
+    required this.lensDirection,
   });
 
   final String name;
@@ -188,9 +183,7 @@ class RScanCameraDescription {
 
   @override
   bool operator ==(Object o) {
-    return o is RScanCameraDescription &&
-        o.name == name &&
-        o.lensDirection == lensDirection;
+    return o is RScanCameraDescription && o.name == name && o.lensDirection == lensDirection;
   }
 
   @override
@@ -243,8 +236,7 @@ enum RScanCameraResolutionPreset {
 }
 
 /// Returns the resolution preset as a String.
-String _serializeResolutionPreset(
-    RScanCameraResolutionPreset resolutionPreset) {
+String _serializeResolutionPreset(RScanCameraResolutionPreset resolutionPreset) {
   switch (resolutionPreset) {
     case RScanCameraResolutionPreset.max:
       return 'max';
@@ -258,16 +250,20 @@ String _serializeResolutionPreset(
       return 'medium';
     case RScanCameraResolutionPreset.low:
       return 'low';
+    default:
+      throw ArgumentError('Unknown ResolutionPreset value');
   }
-  throw ArgumentError('Unknown ResolutionPreset value');
 }
 
 /// exception
 class RScanCameraException implements Exception {
-  RScanCameraException(this.code, this.description);
+  RScanCameraException(
+    this.code,
+    this.description,
+  );
 
   String code;
-  String description;
+  String? description;
 
   @override
   String toString() => '$runtimeType($code, $description)';

+ 138 - 138
lib/src/r_scan_view.dart

@@ -1,138 +1,138 @@
-// Copyright 2019 The rhyme_lph Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-import 'dart:async';
-import 'dart:io';
-
-import 'package:flutter/material.dart';
-import 'package:flutter/services.dart';
-
-import '../r_scan.dart';
-
-const _scanType = 'com.rhyme_lph/r_scan_view';
-
-typedef void ScanResultCallback(String result);
-
-/// qr scan view , it need to  require camera permission.
-@Deprecated("please use 'RScanCamera'")
-class RScanView extends StatefulWidget {
-  final RScanController controller;
-
-  const RScanView({this.controller}) : assert(controller != null);
-
-  @override
-  State<StatefulWidget> createState() => _RScanViewState();
-}
-
-class _RScanViewState extends State<RScanView> {
-  RScanController _controller;
-
-  void onPlatformViewCreated(int id) {
-    _controller.attach(id);
-  }
-
-  @override
-  void initState() {
-    super.initState();
-    _controller = widget.controller ?? RScanController();
-    SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.top]);
-  }
-
-  @override
-  void dispose() {
-    super.dispose();
-    _controller.detach();
-  }
-
-  @override
-  Widget build(BuildContext context) {
-    dynamic params = {
-      "isPlay": _controller.isPlay,
-    };
-    Widget child;
-    if (Platform.isAndroid) {
-      child = AndroidView(
-        viewType: _scanType,
-        onPlatformViewCreated: onPlatformViewCreated,
-        creationParams: params,
-        creationParamsCodec: StandardMessageCodec(),
-      );
-    } else if (Platform.isIOS) {
-      child = UiKitView(
-        viewType: _scanType,
-        onPlatformViewCreated: onPlatformViewCreated,
-        creationParams: params,
-        creationParamsCodec: StandardMessageCodec(),
-      );
-    } else {
-      child = Container(
-        child: Text('Not support ${Platform.operatingSystem} platform.'),
-      );
-    }
-
-    return child;
-  }
-}
-
-/// qr scan view controller .
-/// can startScan or stopScan .
-@Deprecated("please use 'RScanCameraController'")
-class RScanController extends ChangeNotifier {
-  Stream _stream;
-  StreamSubscription _subscription;
-  RScanResult result;
-  EventChannel _channel;
-  bool isPlay;
-  MethodChannel _methodChannel;
-
-  RScanController({this.isPlay: true})
-      : assert(isPlay != null),
-        super();
-
-  void attach(int id) {
-    _channel = EventChannel('${_scanType}_$id/event');
-    _methodChannel = MethodChannel('${_scanType}_$id/method');
-    _stream = _channel.receiveBroadcastStream(
-      {
-        "isPlay": isPlay,
-      },
-    );
-    _subscription = _stream.listen((data) {
-      this.result = RScanResult.formMap(data);
-      notifyListeners();
-    });
-  }
-
-  //开始扫描
-  Future<void> startScan() async {
-    await _methodChannel.invokeMethod('startScan');
-  }
-
-  //停止扫描
-  Future<void> stopScan() async {
-    await _methodChannel.invokeMethod('stopScan');
-  }
-
-  /// flash mode open or close.
-  ///
-  /// [isOpen] if false will close flash mode.
-  ///
-  /// It will return is success.
-  Future<bool> setFlashMode(bool isOpen) async =>
-      await _methodChannel.invokeMethod('setFlashMode', {
-        'isOpen': isOpen,
-      });
-
-  /// flash mode open or close.
-  ///
-  /// [isOpen] if false will close flash mode.
-  ///
-  /// It will return is success.
-  Future<bool> getFlashMode() async =>
-      await _methodChannel.invokeMethod('getFlashMode');
-
-  void detach() {
-    _subscription?.cancel();
-    notifyListeners();
-  }
-}
+// // Copyright 2019 The rhyme_lph Authors. All rights reserved.
+// // Use of this source code is governed by a BSD-style license that can be
+// // found in the LICENSE file.
+// import 'dart:async';
+// import 'dart:io';
+
+// import 'package:flutter/material.dart';
+// import 'package:flutter/services.dart';
+
+// import '../r_scan.dart';
+
+// const _scanType = 'com.rhyme_lph/r_scan_view';
+
+// typedef void ScanResultCallback(String result);
+
+// /// qr scan view , it need to  require camera permission.
+// @Deprecated("please use 'RScanCamera'")
+// class RScanView extends StatefulWidget {
+//   final RScanController controller;
+
+//   const RScanView({
+//     this.controller,
+//   }) : assert(controller != null);
+
+//   @override
+//   State<StatefulWidget> createState() => _RScanViewState();
+// }
+
+// class _RScanViewState extends State<RScanView> {
+//   RScanController _controller;
+
+//   void onPlatformViewCreated(int id) {
+//     _controller.attach(id);
+//   }
+
+//   @override
+//   void initState() {
+//     super.initState();
+//     _controller = widget.controller ?? RScanController();
+//     SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.top]);
+//   }
+
+//   @override
+//   void dispose() {
+//     super.dispose();
+//     _controller.detach();
+//   }
+
+//   @override
+//   Widget build(BuildContext context) {
+//     dynamic params = {
+//       "isPlay": _controller.isPlay,
+//     };
+//     Widget child;
+//     if (Platform.isAndroid) {
+//       child = AndroidView(
+//         viewType: _scanType,
+//         onPlatformViewCreated: onPlatformViewCreated,
+//         creationParams: params,
+//         creationParamsCodec: StandardMessageCodec(),
+//       );
+//     } else if (Platform.isIOS) {
+//       child = UiKitView(
+//         viewType: _scanType,
+//         onPlatformViewCreated: onPlatformViewCreated,
+//         creationParams: params,
+//         creationParamsCodec: StandardMessageCodec(),
+//       );
+//     } else {
+//       child = Container(
+//         child: Text('Not support ${Platform.operatingSystem} platform.'),
+//       );
+//     }
+
+//     return child;
+//   }
+// }
+
+// /// qr scan view controller .
+// /// can startScan or stopScan .
+// @Deprecated("please use 'RScanCameraController'")
+// class RScanController extends ChangeNotifier {
+//   Stream _stream;
+//   StreamSubscription _subscription;
+//   RScanResult result;
+//   EventChannel _channel;
+//   bool isPlay;
+//   MethodChannel _methodChannel;
+
+//   RScanController({this.isPlay: true})
+//       : assert(isPlay != null),
+//         super();
+
+//   void attach(int id) {
+//     _channel = EventChannel('${_scanType}_$id/event');
+//     _methodChannel = MethodChannel('${_scanType}_$id/method');
+//     _stream = _channel.receiveBroadcastStream(
+//       {
+//         "isPlay": isPlay,
+//       },
+//     );
+//     _subscription = _stream.listen((data) {
+//       this.result = RScanResult.formMap(data);
+//       notifyListeners();
+//     });
+//   }
+
+//   //开始扫描
+//   Future<void> startScan() async {
+//     await _methodChannel.invokeMethod('startScan');
+//   }
+
+//   //停止扫描
+//   Future<void> stopScan() async {
+//     await _methodChannel.invokeMethod('stopScan');
+//   }
+
+//   /// flash mode open or close.
+//   ///
+//   /// [isOpen] if false will close flash mode.
+//   ///
+//   /// It will return is success.
+//   Future<bool> setFlashMode(bool isOpen) async => await _methodChannel.invokeMethod('setFlashMode', {
+//         'isOpen': isOpen,
+//       });
+
+//   /// flash mode open or close.
+//   ///
+//   /// [isOpen] if false will close flash mode.
+//   ///
+//   /// It will return is success.
+//   Future<bool> getFlashMode() async => await _methodChannel.invokeMethod('getFlashMode');
+
+//   void detach() {
+//     _subscription?.cancel();
+//     notifyListeners();
+//   }
+// }

+ 20 - 19
pubspec.lock

@@ -7,49 +7,49 @@ packages:
       name: async
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "2.5.0-nullsafety.1"
+    version: "2.5.0"
   boolean_selector:
     dependency: transitive
     description:
       name: boolean_selector
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "2.1.0-nullsafety.1"
+    version: "2.1.0"
   characters:
     dependency: transitive
     description:
       name: characters
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.1.0-nullsafety.3"
+    version: "1.1.0"
   charcode:
     dependency: transitive
     description:
       name: charcode
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.2.0-nullsafety.1"
+    version: "1.2.0"
   clock:
     dependency: transitive
     description:
       name: clock
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.1.0-nullsafety.1"
+    version: "1.1.0"
   collection:
     dependency: transitive
     description:
       name: collection
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.15.0-nullsafety.3"
+    version: "1.15.0"
   fake_async:
     dependency: transitive
     description:
       name: fake_async
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.2.0-nullsafety.1"
+    version: "1.2.0"
   flutter:
     dependency: "direct main"
     description: flutter
@@ -66,21 +66,21 @@ packages:
       name: matcher
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "0.12.10-nullsafety.1"
+    version: "0.12.10"
   meta:
     dependency: transitive
     description:
       name: meta
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.3.0-nullsafety.3"
+    version: "1.3.0"
   path:
     dependency: transitive
     description:
       name: path
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.8.0-nullsafety.1"
+    version: "1.8.0"
   sky_engine:
     dependency: transitive
     description: flutter
@@ -92,55 +92,56 @@ packages:
       name: source_span
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.8.0-nullsafety.2"
+    version: "1.8.0"
   stack_trace:
     dependency: transitive
     description:
       name: stack_trace
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.10.0-nullsafety.1"
+    version: "1.10.0"
   stream_channel:
     dependency: transitive
     description:
       name: stream_channel
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "2.1.0-nullsafety.1"
+    version: "2.1.0"
   string_scanner:
     dependency: transitive
     description:
       name: string_scanner
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.1.0-nullsafety.1"
+    version: "1.1.0"
   term_glyph:
     dependency: transitive
     description:
       name: term_glyph
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.2.0-nullsafety.1"
+    version: "1.2.0"
   test_api:
     dependency: transitive
     description:
       name: test_api
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "0.2.19-nullsafety.2"
+    version: "0.2.19"
   typed_data:
     dependency: transitive
     description:
       name: typed_data
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.3.0-nullsafety.3"
+    version: "1.3.0"
   vector_math:
     dependency: transitive
     description:
       name: vector_math
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "2.1.0-nullsafety.3"
+    version: "2.1.0"
 sdks:
-  dart: ">=2.10.0-110 <2.11.0"
+  dart: ">=2.12.0 <3.0.0"
+  flutter: ">=2.0.0"

+ 5 - 41
pubspec.yaml

@@ -1,10 +1,12 @@
 name: r_scan
 description: A flutter plugin about qr code scan,it can scan from file、url、memory and camera qr code.
-version: 0.1.4+1
-homepage: https://github.com/rhymelph/r_scan
+version: 1.0.0-nullsafety
+
+publish_to: none
 
 environment:
-  sdk: ">=2.1.0 <3.0.0"
+  sdk: ">=2.12.0 <3.0.0"
+  flutter: ">=2.0.0 <3.0.0"
 
 dependencies:
   flutter:
@@ -13,46 +15,8 @@ dev_dependencies:
   flutter_test:
     sdk: flutter
 
-# For information on the generic Dart part of this file, see the
-# following page: https://dart.dev/tools/pub/pubspec
-
-# The following section is specific to Flutter.
 flutter:
-  # This section identifies this Flutter project as a plugin project.
-  # The androidPackage and pluginClass identifiers should not ordinarily
-  # be modified. They are used by the tooling to maintain consistency when
-  # adding or updating assets for this project.
   plugin:
     androidPackage: com.rhyme.r_scan
     pluginClass: RScanPlugin
 
-  # 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.dev/assets-and-images/#from-packages
-  #
-  # An image asset can refer to one or more resolution-specific "variants", see
-  # https://flutter.dev/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.dev/custom-fonts/#from-packages