Open riddhij16 opened 3 years ago
even after running the basic Eg given in the docs.. getting getter length was null error:
E/flutter (19943): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: NoSuchMethodError: The getter 'length' was called on null. E/flutter (19943): Receiver: null E/flutter (19943): Tried calling: length
Android
import 'dart:io'; import 'package:flutter/material.dart'; import 'package:video_compress/video_compress.dart'; import 'package:image_picker/image_picker.dart';
class Compresss extends StatefulWidget { @override _CompresssState createState() => _CompresssState(); }
class _CompresssState extends State { Subscription _subscription; @override void initState() { super.initState(); _subscription = VideoCompress.compressProgress$.subscribe((progress) { debugPrint('progress: $progress'); }); }
@override void dispose() { super.dispose(); _subscription.unsubscribe(); }
@override Widget build(BuildContext context) { return Scaffold( body: Center(child: FlatButton(onPressed: videoPick, child: Text("press"))), ); }
void videoPick() async { File file = await ImagePicker.pickVideo(source: ImageSource.gallery); final info = await VideoCompress.compressVideo( file.path, // quality: VideoQuality.MediumQuality, // deleteOrigin: false, ); print("done"); // setState(() {}); } }
### Expected solution Expect description of the solution
Description
even after running the basic Eg given in the docs.. getting getter length was null error:
E/flutter (19943): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: NoSuchMethodError: The getter 'length' was called on null. E/flutter (19943): Receiver: null E/flutter (19943): Tried calling: length
Platform
Android
Code Example (if has)
import 'dart:io'; import 'package:flutter/material.dart'; import 'package:video_compress/video_compress.dart'; import 'package:image_picker/image_picker.dart';
class Compresss extends StatefulWidget { @override _CompresssState createState() => _CompresssState(); }
class _CompresssState extends State {
Subscription _subscription;
@override
void initState() {
super.initState();
_subscription = VideoCompress.compressProgress$.subscribe((progress) {
debugPrint('progress: $progress');
});
}
@override void dispose() { super.dispose(); _subscription.unsubscribe(); }
@override Widget build(BuildContext context) { return Scaffold( body: Center(child: FlatButton(onPressed: videoPick, child: Text("press"))), ); }
void videoPick() async { File file = await ImagePicker.pickVideo(source: ImageSource.gallery); final info = await VideoCompress.compressVideo( file.path, // quality: VideoQuality.MediumQuality, // deleteOrigin: false, ); print("done"); // setState(() {}); } }