diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies new file mode 100644 index 0000000..e032aeb --- /dev/null +++ b/example/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_video_compress","path":"/Users/develappsdeveloper/development/felipe/migrations/flutter_video_compress/","dependencies":[]},{"name":"image_picker","path":"/Users/develappsdeveloper/development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.8.4+4/","dependencies":[]},{"name":"video_player","path":"/Users/develappsdeveloper/development/flutter/.pub-cache/hosted/pub.dartlang.org/video_player-2.2.6/","dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"/Users/develappsdeveloper/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-2.0.4/","dependencies":[]},{"name":"flutter_video_compress","path":"/Users/develappsdeveloper/development/felipe/migrations/flutter_video_compress/","dependencies":[]},{"name":"image_picker","path":"/Users/develappsdeveloper/development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.8.4+4/","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"video_player","path":"/Users/develappsdeveloper/development/flutter/.pub-cache/hosted/pub.dartlang.org/video_player-2.2.6/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[{"name":"image_picker_for_web","path":"/Users/develappsdeveloper/development/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_for_web-2.1.4/","dependencies":[]},{"name":"video_player_web","path":"/Users/develappsdeveloper/development/flutter/.pub-cache/hosted/pub.dartlang.org/video_player_web-2.0.4/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_video_compress","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle","image_picker_for_web"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"video_player","dependencies":["video_player_web"]},{"name":"video_player_web","dependencies":[]}],"date_created":"2021-11-06 13:03:33.632315","version":"2.5.3"} \ No newline at end of file diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh new file mode 100755 index 0000000..42a8d6b --- /dev/null +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/Users/develappsdeveloper/development/flutter" +export "FLUTTER_APPLICATION_PATH=/Users/develappsdeveloper/development/felipe/migrations/flutter_video_compress/example" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_BUILD_DIR=build" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.packages" diff --git a/example/lib/main.dart b/example/lib/main.dart index fecea4f..2af4bdc 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -12,7 +12,7 @@ void main() => runApp(MyApp(title: 'Flutter Video Compress Example')); class MyApp extends StatefulWidget { MyApp({this.title}); - final String title; + final String? title; @override _MyAppState createState() => _MyAppState(); @@ -20,14 +20,14 @@ class MyApp extends StatefulWidget { class _MyAppState extends State { final _flutterVideoCompress = FlutterVideoCompress(); - Subscription _subscription; + Subscription? _subscription; - Image _thumbnailFileImage; - Image _gifFileImage; + Image? _thumbnailFileImage; + Image? _gifFileImage; MediaInfo _originalVideoInfo = MediaInfo(path: ''); MediaInfo _compressedVideoInfo = MediaInfo(path: ''); - String _taskName; + String? _taskName; double _progressState = 0; final _loadingStreamCtrl = StreamController.broadcast(); @@ -46,7 +46,7 @@ class _MyAppState extends State { @override void dispose() { super.dispose(); - _subscription.unsubscribe(); + _subscription?.unsubscribe(); _loadingStreamCtrl.close(); } @@ -95,11 +95,11 @@ class _MyAppState extends State { Widget _buildMaterialWarp(Widget body) { return MaterialApp( - title: widget.title, + title: widget.title ?? "", theme: myTheme, home: Scaffold( appBar: AppBar( - title: Text(widget.title), + title: Text(widget.title ?? ""), actions: [ IconButton( onPressed: () async { @@ -121,9 +121,9 @@ class _MyAppState extends State { child: Text(text, style: TextStyle(color: Colors.white)), color: Colors.grey[800], onPressed: () async { - final videoFile = await ImagePicker.pickVideo(source: source); + final videoFile = await ImagePicker().pickVideo(source: source); if (videoFile != null) { - runFlutterVideoCompressMethods(videoFile); + runFlutterVideoCompressMethods(videoFile as File); } }, ), @@ -141,7 +141,7 @@ class _MyAppState extends State { } List _buildInfoPanel(String title, - {MediaInfo info, Image image, bool isVideoModel = false}) { + {MediaInfo? info, Image? image, bool isVideoModel = false}) { if (info?.file == null && image == null && !isVideoModel) return []; return [ if (!isVideoModel || info?.file != null) @@ -154,10 +154,10 @@ class _MyAppState extends State { if (info?.file != null) Padding( padding: const EdgeInsets.all(8), - child: Text(_infoConvert(info)), + child: Text(_infoConvert(info!)), ), if (image != null) image, - if (isVideoModel && info?.file != null) VideoPlayerView(file: info.file) + if (isVideoModel && info?.file != null) VideoPlayerView(file: info!.file!) ]; } @@ -253,24 +253,26 @@ class _MyAppState extends State { class VideoPlayerView extends StatefulWidget { VideoPlayerView({this.file}); - final File file; + final File? file; @override _VideoPlayerViewState createState() => _VideoPlayerViewState(); } class _VideoPlayerViewState extends State { - VideoPlayerController _controller; + late VideoPlayerController _controller; @override void initState() { super.initState(); - _controller = VideoPlayerController.file(widget.file) - ..initialize().then((_) { - setState(() {}); - }) - ..setVolume(1) - ..play(); + if (widget.file != null) { + _controller = VideoPlayerController.file(widget.file!) + ..initialize().then((_) { + setState(() {}); + }) + ..setVolume(1) + ..play(); + } } @override @@ -297,7 +299,7 @@ class _VideoPlayerViewState extends State { Stack( alignment: Alignment.center, children: [ - _controller.value.initialized + _controller.value.isInitialized ? AspectRatio( aspectRatio: _controller.value.aspectRatio, child: VideoPlayer(_controller), diff --git a/example/lib/my-theme.dart b/example/lib/my-theme.dart index ab3d92c..5147258 100644 --- a/example/lib/my-theme.dart +++ b/example/lib/my-theme.dart @@ -81,55 +81,55 @@ final ThemeData myTheme = ThemeData( ), ), textTheme: TextTheme( - display4: TextStyle( + headline1: TextStyle( color: Color(0xb3ffffff), fontSize: 96.0, fontWeight: FontWeight.w300, fontStyle: FontStyle.normal, ), - display3: TextStyle( + headline2: TextStyle( color: Color(0xb3ffffff), fontSize: 60.0, fontWeight: FontWeight.w300, fontStyle: FontStyle.normal, ), - display2: TextStyle( + headline3: TextStyle( color: Color(0xb3ffffff), fontSize: 48.0, fontWeight: FontWeight.w400, fontStyle: FontStyle.normal, ), - display1: TextStyle( + headline4: TextStyle( color: Color(0xb3ffffff), fontSize: 34.0, fontWeight: FontWeight.w400, fontStyle: FontStyle.normal, ), - headline: TextStyle( + headline5: TextStyle( color: Color(0xffffffff), fontSize: 24.0, fontWeight: FontWeight.w400, fontStyle: FontStyle.normal, ), - title: TextStyle( + headline6: TextStyle( color: Color(0xffffffff), fontSize: 20.0, fontWeight: FontWeight.w500, fontStyle: FontStyle.normal, ), - subhead: TextStyle( + subtitle1: TextStyle( color: Color(0xffffffff), fontSize: 16.0, fontWeight: FontWeight.w400, fontStyle: FontStyle.normal, ), - body2: TextStyle( + bodyText1: TextStyle( color: Color(0xffffffff), fontSize: 14.0, fontWeight: FontWeight.w400, fontStyle: FontStyle.normal, ), - body1: TextStyle( + bodyText2: TextStyle( color: Color(0xffffffff), fontSize: 16.0, fontWeight: FontWeight.w400, @@ -147,7 +147,7 @@ final ThemeData myTheme = ThemeData( fontWeight: FontWeight.w500, fontStyle: FontStyle.normal, ), - subtitle: TextStyle( + subtitle2: TextStyle( color: Color(0xffffffff), fontSize: 14.0, fontWeight: FontWeight.w500, @@ -161,55 +161,55 @@ final ThemeData myTheme = ThemeData( ), ), primaryTextTheme: TextTheme( - display4: TextStyle( + headline1: TextStyle( color: Color(0xb3ffffff), fontSize: 96.0, fontWeight: FontWeight.w300, fontStyle: FontStyle.normal, ), - display3: TextStyle( + headline2: TextStyle( color: Color(0xb3ffffff), fontSize: 60.0, fontWeight: FontWeight.w300, fontStyle: FontStyle.normal, ), - display2: TextStyle( + headline3: TextStyle( color: Color(0xb3ffffff), fontSize: 48.0, fontWeight: FontWeight.w400, fontStyle: FontStyle.normal, ), - display1: TextStyle( + headline4: TextStyle( color: Color(0xb3ffffff), fontSize: 34.0, fontWeight: FontWeight.w400, fontStyle: FontStyle.normal, ), - headline: TextStyle( + headline5: TextStyle( color: Color(0xffffffff), fontSize: 24.0, fontWeight: FontWeight.w400, fontStyle: FontStyle.normal, ), - title: TextStyle( + headline6: TextStyle( color: Color(0xffffffff), fontSize: 20.0, fontWeight: FontWeight.w500, fontStyle: FontStyle.normal, ), - subhead: TextStyle( + subtitle1: TextStyle( color: Color(0xffffffff), fontSize: 16.0, fontWeight: FontWeight.w400, fontStyle: FontStyle.normal, ), - body2: TextStyle( + bodyText1: TextStyle( color: Color(0xffffffff), fontSize: 14.0, fontWeight: FontWeight.w400, fontStyle: FontStyle.normal, ), - body1: TextStyle( + bodyText2: TextStyle( color: Color(0xffffffff), fontSize: 16.0, fontWeight: FontWeight.w400, @@ -227,7 +227,7 @@ final ThemeData myTheme = ThemeData( fontWeight: FontWeight.w500, fontStyle: FontStyle.normal, ), - subtitle: TextStyle( + subtitle2: TextStyle( color: Color(0xffffffff), fontSize: 14.0, fontWeight: FontWeight.w500, @@ -240,86 +240,6 @@ final ThemeData myTheme = ThemeData( fontStyle: FontStyle.normal, ), ), - accentTextTheme: TextTheme( - display4: TextStyle( - color: Color(0x8a000000), - fontSize: 96.0, - fontWeight: FontWeight.w300, - fontStyle: FontStyle.normal, - ), - display3: TextStyle( - color: Color(0x8a000000), - fontSize: 60.0, - fontWeight: FontWeight.w300, - fontStyle: FontStyle.normal, - ), - display2: TextStyle( - color: Color(0x8a000000), - fontSize: 48.0, - fontWeight: FontWeight.w400, - fontStyle: FontStyle.normal, - ), - display1: TextStyle( - color: Color(0x8a000000), - fontSize: 34.0, - fontWeight: FontWeight.w400, - fontStyle: FontStyle.normal, - ), - headline: TextStyle( - color: Color(0xdd000000), - fontSize: 24.0, - fontWeight: FontWeight.w400, - fontStyle: FontStyle.normal, - ), - title: TextStyle( - color: Color(0xdd000000), - fontSize: 20.0, - fontWeight: FontWeight.w500, - fontStyle: FontStyle.normal, - ), - subhead: TextStyle( - color: Color(0xdd000000), - fontSize: 16.0, - fontWeight: FontWeight.w400, - fontStyle: FontStyle.normal, - ), - body2: TextStyle( - color: Color(0xdd000000), - fontSize: 14.0, - fontWeight: FontWeight.w400, - fontStyle: FontStyle.normal, - ), - body1: TextStyle( - color: Color(0xdd000000), - fontSize: 16.0, - fontWeight: FontWeight.w400, - fontStyle: FontStyle.normal, - ), - caption: TextStyle( - color: Color(0x8a000000), - fontSize: 12.0, - fontWeight: FontWeight.w400, - fontStyle: FontStyle.normal, - ), - button: TextStyle( - color: Color(0xdd000000), - fontSize: 14.0, - fontWeight: FontWeight.w500, - fontStyle: FontStyle.normal, - ), - subtitle: TextStyle( - color: Color(0xff000000), - fontSize: 14.0, - fontWeight: FontWeight.w500, - fontStyle: FontStyle.normal, - ), - overline: TextStyle( - color: Color(0xff000000), - fontSize: 10.0, - fontWeight: FontWeight.w400, - fontStyle: FontStyle.normal, - ), - ), inputDecorationTheme: InputDecorationTheme( labelStyle: TextStyle( color: Color(0xffffffff), @@ -346,7 +266,7 @@ final ThemeData myTheme = ThemeData( fontStyle: FontStyle.normal, ), errorMaxLines: null, - hasFloatingPlaceholder: true, + floatingLabelBehavior: FloatingLabelBehavior.auto, isDense: false, contentPadding: EdgeInsets.only(top: 12.0, bottom: 12.0, left: 0.0, right: 0.0), diff --git a/example/pubspec.lock b/example/pubspec.lock index a35b82c..7fbbbfd 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,5 +1,5 @@ # Generated by pub -# See https://www.dartlang.org/tools/pub/glossary#lockfile +# See https://dart.dev/tools/pub/glossary#lockfile packages: async: dependency: transitive @@ -7,40 +7,82 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.8.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.3.1" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.15.0" + cross_file: + dependency: transitive + description: + name: cross_file + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.2" + csslib: + dependency: transitive + description: + name: csslib + url: "https://pub.dartlang.org" + source: hosted + version: "0.17.1" cupertino_icons: dependency: "direct main" description: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "0.1.2" + version: "1.0.4" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.4" flutter_test: dependency: "direct dev" description: flutter @@ -53,45 +95,85 @@ packages: relative: true source: path version: "0.3.7+8" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + html: + dependency: transitive + description: + name: html + url: "https://pub.dartlang.org" + source: hosted + version: "0.15.0" + http: + dependency: transitive + description: + name: http + url: "https://pub.dartlang.org" + source: hosted + version: "0.13.4" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.0" image_picker: dependency: "direct main" description: name: image_picker url: "https://pub.dartlang.org" source: hosted - version: "0.6.0+10" + version: "0.8.4+4" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.4" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.1" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.3" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.5" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.7.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.2" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.0" - quiver: + version: "1.8.0" + plugin_platform_interface: dependency: transitive description: - name: quiver + name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted version: "2.0.2" @@ -106,63 +188,77 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.4" + version: "0.4.2" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0" video_player: dependency: "direct main" description: name: video_player url: "https://pub.dartlang.org" source: hosted - version: "0.10.1+3" + version: "2.2.6" + video_player_platform_interface: + dependency: transitive + description: + name: video_player_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "4.2.0" + video_player_web: + dependency: transitive + description: + name: video_player_web + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.4" sdks: - dart: ">=2.2.2 <3.0.0" - flutter: ">=1.5.0 <2.0.0" + dart: ">=2.14.0 <3.0.0" + flutter: ">=2.5.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 310b80f..3e5e29e 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -3,7 +3,7 @@ description: Demonstrates how to use the flutter_video_compress plugin. publish_to: 'none' environment: - sdk: ">=2.2.2 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: flutter: @@ -11,9 +11,9 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^0.1.2 - image_picker: ^0.6.0+10 - video_player: ^0.10.1+3 + cupertino_icons: ^1.0.4 + image_picker: ^0.8.4+4 + video_player: ^2.2.6 dev_dependencies: flutter_test: diff --git a/lib/model/media_info.dart b/lib/model/media_info.dart index 0cf83b2..0ce5ae3 100644 --- a/lib/model/media_info.dart +++ b/lib/model/media_info.dart @@ -1,24 +1,24 @@ part of flutter_video_compress; class MediaInfo { - String path; - String title; - String author; - int width; - int height; + String? path; + String? title; + String? author; + int? width; + int? height; /// [Android] API level 17 - int orientation; + int? orientation; /// bytes - int filesize; // filesize + int? filesize; // filesize /// microsecond - double duration; - bool isCancel; - File file; + double? duration; + bool? isCancel; + File? file; MediaInfo({ - @required this.path, + this.path, this.title, this.author, this.width, @@ -40,7 +40,7 @@ class MediaInfo { filesize = json['filesize']; duration = double.tryParse('${json['duration']}'); isCancel = json['isCancel']; - file = File(path); + file = File(path ?? ""); } Map toJson() { @@ -58,7 +58,7 @@ class MediaInfo { if (this.isCancel != null) { data['isCancel'] = this.isCancel; } - data['file'] = File(path).toString(); + data['file'] = File(path ?? "").toString(); return data; } } diff --git a/lib/src/flutter_video_compress.dart b/lib/src/flutter_video_compress.dart index a8eb1f8..4e69fad 100644 --- a/lib/src/flutter_video_compress.dart +++ b/lib/src/flutter_video_compress.dart @@ -26,14 +26,14 @@ class FlutterVideoCompress { } } - void _updateProgressState(double state) { + void _updateProgressState(double? state) { if (state != null) { compressProgress$.next(state); } } - Future _invoke(String name, [Map params]) async { - T result; + Future _invoke(String name, [Map? params]) async { + T? result; try { result = params != null ? await _channel.invokeMethod(name, params) @@ -59,8 +59,8 @@ class FlutterVideoCompress { /// quality: 50, /// ); /// ``` - Future getThumbnail( - String path, { + Future getThumbnail( + String? path, { int quality = 100, int position = -1, }) async { @@ -87,7 +87,7 @@ class FlutterVideoCompress { /// ); /// ``` Future getThumbnailWithFile( - String path, { + String? path, { int quality = 100, int position = -1, }) async { @@ -100,7 +100,7 @@ class FlutterVideoCompress { 'position': position, }); - final file = File(filePath); + final file = File(filePath ?? ""); return file; } @@ -123,7 +123,7 @@ class FlutterVideoCompress { /// debugPrint(file.path); /// ``` Future convertVideoToGif( - String path, { + String? path, { int startTime = 0, int endTime = -1, int duration = -1, // When you do not know the end time @@ -139,7 +139,7 @@ class FlutterVideoCompress { 'duration': duration }); - final file = File(filePath); + final file = File(filePath ?? ""); return file; } @@ -153,10 +153,10 @@ class FlutterVideoCompress { /// final info = await _flutterVideoCompress.getMediaInfo(file.path); /// debugPrint(info.toJson()); /// ``` - Future getMediaInfo(String path) async { + Future getMediaInfo(String? path) async { assert(path != null); final jsonStr = await _invoke('getMediaInfo', {'path': path}); - final jsonMap = json.decode(jsonStr); + final jsonMap = json.decode(jsonStr ?? ""); return MediaInfo.fromJson(jsonMap); } @@ -176,13 +176,13 @@ class FlutterVideoCompress { /// debugPrint(info.toJson()); /// ``` Future compressVideo( - String path, { + String? path, { VideoQuality quality = VideoQuality.DefaultQuality, bool deleteOrigin = false, - int startTime, - int duration, - bool includeAudio, - int frameRate, + int? startTime, + int? duration, + bool? includeAudio, + int? frameRate, }) async { assert(path != null); if (_isCompressing) { @@ -205,7 +205,7 @@ class FlutterVideoCompress { 'frameRate': frameRate, }); _isCompressing = false; - final jsonMap = json.decode(jsonStr); + final jsonMap = json.decode(jsonStr ?? ""); return MediaInfo.fromJson(jsonMap); } @@ -228,6 +228,6 @@ class FlutterVideoCompress { /// await _flutterVideoCompress.deleteAllCache(); /// ``` Future deleteAllCache() async { - return await _invoke('deleteAllCache'); + return await _invoke('deleteAllCache') ?? false; } } diff --git a/lib/src/observable_builder.dart b/lib/src/observable_builder.dart index bab92e6..09f4fae 100644 --- a/lib/src/observable_builder.dart +++ b/lib/src/observable_builder.dart @@ -12,7 +12,7 @@ class ObservableBuilder { } Subscription subscribe(void onData(T event), - {Function onError, void onDone(), bool cancelOnError}) { + {Function? onError, void onDone()?, bool? cancelOnError}) { _notSubscribed = false; _observable.stream.listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError); diff --git a/pubspec.yaml b/pubspec.yaml index 7d01603..1c5d471 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ author: Tenkai Ruri homepage: https://github.com/TenkaiRuri/flutter_video_compress environment: - sdk: ">=2.0.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: flutter: @@ -14,8 +14,8 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - image_picker: ^0.6.0+10 - video_player: ^0.10.1+3 + image_picker: ^0.8.4+4 + video_player: ^2.2.6 # For information on the generic Dart part of this file, see the