Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compressImageList: Null check operator used on a null value #31

Open
Sultanic opened this issue Jun 23, 2022 · 0 comments
Open

compressImageList: Null check operator used on a null value #31

Sultanic opened this issue Jun 23, 2022 · 0 comments

Comments

@Sultanic
Copy link

Code & error:

    final compressionList = <CompressObject>[];
    for (final image in images) {
      compressionList.add(
        CompressObject(
          imageFile: File(image.path),
          quality: 30,
          step: 9,
        ),
      );
    }

    final compressedImages = <XFile>[];
    await Luban.compressImageList(compressionList).then((paths) {  // <= Exception here
      for (final path in paths) {
        if (path != null) {
          compressedImages.add(XFile(path));
        }
      }
    });
E/flutter (26892): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: Null check operator used on a null value
E/flutter (26892): #0      Luban._lubanCompress (package:flutter_luban/src/flutter_luban.dart:91:22)
E/flutter (26892): #1      Luban._lubanCompressList.<anonymous closure> (package:flutter_luban/src/flutter_luban.dart:44:19)
E/flutter (26892): #2      List.forEach (dart:core-patch/growable_array.dart:416:8)
E/flutter (26892): #3      Luban._lubanCompressList (package:flutter_luban/src/flutter_luban.dart:43:13)
E/flutter (26892): #4      _IsolateConfiguration.applyAndTime.<anonymous closure>
package:flutter/…/foundation/_isolates_io.dart:107
E/flutter (26892): #5      Timeline.timeSync (dart:developer/timeline.dart:157:22)
E/flutter (26892): #6      _IsolateConfiguration.applyAndTime
package:flutter/…/foundation/_isolates_io.dart:105
E/flutter (26892): #7      _spawn
package:flutter/…/foundation/_isolates_io.dart:126
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant