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

image_gallery_saver.dart may need to import 'dart:typed_data' #264

Closed
Howard2595 opened this issue Sep 15, 2023 · 6 comments
Closed

image_gallery_saver.dart may need to import 'dart:typed_data' #264

Howard2595 opened this issue Sep 15, 2023 · 6 comments

Comments

@Howard2595
Copy link

When I run the project, the console throws an error like 'Error: Type 'Uint8List' not found.'.

I later found that the 'image_gallery_saver.dart' file did not include the 'dart:typed_data' import statement at the top.

Similar to the code below.

import 'dart:async';
import 'dart:typed_data';

import 'package:flutter/services.dart';

class ImageGallerySaver {
  // ... Omitting relevant code
  static FutureOr<dynamic> saveImage(Uint8List imageBytes,
      {int quality = 80,
      String? name,
      bool isReturnImagePathOfIOS = false}) async {
      // ... Omitting relevant code
  }
  // ... Omitting relevant code
}

Hope you can consider.

@woodwen
Copy link
Contributor

woodwen commented Sep 19, 2023

The import of 'dart:typed_data' is unnecessary because all of the used elements are also provided by the import of 'package:flutter/services.dart'

@Howard2595
Copy link
Author

Hi @woodwen , Thanks for your reply.

I'm not sure about the latest version of Flutter, is it okay to directly import 'package:flutter/services.dart'? However, it doesn't work with my current Flutter version (v2.10.0).

@woodwen
Copy link
Contributor

woodwen commented Sep 20, 2023

The current development version of image_gallery_saver uses flutter 3.10.5. Each subsequent flutter version upgrade will be marked in the readme.

@Howard2595
Copy link
Author

Howard2595 commented Sep 20, 2023

Hi @woodwen, I didn't find any specific Min Dart SDK requirements on pub.package, and I noticed that in the pubspec.yaml file, it's written as flutter: ">=1.17.0", which doesn't restrict users from using older versions of Flutter. So, can we consider adding 'dart:typed_data' for now, and later, after restricting the Flutter version, we can remove it?

@maruzimuslih
Copy link

maruzimuslih commented Sep 22, 2023

Hi @woodwen , i have the same issue here. I use 2.10.1 flutter version, and i can't build my app. I think @Howard2595 suggestion is good and reasonable. Hopefully you can consider it. Thank you

@Go-oG
Copy link

Go-oG commented Nov 16, 2023

We're waiting for the PR270 merger when that issue will be resolved

@Go-oG Go-oG closed this as completed Nov 16, 2023
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

4 participants