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

[BUG] Project does not compile to web using 7+ version (worked fine before) #268

Closed
LeGoffMael opened this issue Mar 8, 2022 · 9 comments · Fixed by #273
Closed

[BUG] Project does not compile to web using 7+ version (worked fine before) #268

LeGoffMael opened this issue Mar 8, 2022 · 9 comments · Fixed by #273
Labels
b: third party This is a third party package issue. r: extended_image Related to the extended_image package. s: enhancement New feature or request. ⏳WEEK This issue is scheduled to be solved within one week.

Comments

@LeGoffMael
Copy link
Collaborator

Describe the bug

Project does not compile in web using 7.0.1.
It worked fine with <7 version. There is no problem on mobile.

It looks like it is related to live pictures and extended_image_library.

Tested and found in both 7.0.0 and 7.0.1.

How to reproduce

Steps to reproduce the behavior:

  1. Add this plugin (wechat_assets_picker: ^7.0.1) to pubspec.yaml
  2. Start debugging to chrome.
  3. Failed to compile application. error message in the log

Expected behavior

Even if this plugin does not support web, project should be able to compile for web env normally, like in previous version.

Version information

  • Device: Chrome
  • OS: Macbook pro (intel chip)
  • Package Version: 7.0.1
  • Flutter Version: 2.10.3

Additional context

Launching lib[/main.dart]() on Chrome in debug mode...
libmain.dart:1
: Error: A value of type 'File*1*?' can't be assigned to a variable of type 'File*2*?'.
..…builderimage_page_builder.dart:53
 - 'File/*1*/' is from 'dart:io'.
- 'File/*2*/' is from 'package:extended_image_library[/src/_platform_web.dart]()' ('.[./../../.pub-cache/hosted/pub.dartlang.org/extended_image_library-3.1.2/lib/src/_platform_web.dart]()').
package:extended_image_librarysrc_platform_web.dart:1
      file = await widget.asset.originFileWithSubtype;

             ^
: Error: A value of type 'File*1*?' can't be assigned to a variable of type 'File*2*?'.
..…builder/image_page_builder.dart:55
 - 'File/*1*/' is from 'dart:io'.
- 'File/*2*/' is from 'package:extended_image_library[/src/_platform_web.dart]()' ('.[./../../.pub-cache/hosted/pub.dartlang.org/extended_image_library-3.1.2/lib/src/_platform_web.dart]()').
package:extended_image_librarysrc_platform_web.dart:1
      file = await widget.asset.fileWithSubtype;
             ^

: Error: The argument type 'File*1*' can't be assigned to the parameter type 'File*2*'.
../…/builder/image_page_builder.dart:61
- 'File/*1*/' is from 'package:extended_image_library[/src/_platform_web.dart]()' ('.[./../../.pub-cache/hosted/pub.dartlang.org/extended_image_library-3.1.2/lib/src/_platform_web.dart]()').
package:extended_image_librarysrc_platform_web.dart:1

 - 'File/*2*/' is from 'dart:io'.
      file,
      ^

Failed to compile application.
Exited (sigterm)
@LeGoffMael LeGoffMael added the await investigate The issue is waiting for further investigation. label Mar 8, 2022
@github-actions github-actions bot added the await triage The issue is waiting for triage. label Mar 8, 2022
@LeGoffMael LeGoffMael changed the title [BUG] Project does not compile to web using 7.0.1 version (worked fine before) [BUG] Project does not compile to web using 7+ version (worked fine before) Mar 8, 2022
@AlexV525
Copy link
Member

AlexV525 commented Mar 8, 2022

We didn't support the Web platform. Duplicate with #227.

@AlexV525 AlexV525 closed this as completed Mar 8, 2022
@AlexV525 AlexV525 added i: duplicate This issue or pull request already exists. s: invalid This doesn't seem right. and removed await triage The issue is waiting for triage. await investigate The issue is waiting for further investigation. labels Mar 8, 2022
@LeGoffMael
Copy link
Collaborator Author

LeGoffMael commented Mar 8, 2022

Yes you're right but they were no problem with previous version 6.3.1.

@AlexV525
Copy link
Member

AlexV525 commented Mar 8, 2022

It's not about whether the path is working, but whether it's valid. We don't guarantee any invalid usage.

@LeGoffMael
Copy link
Collaborator Author

I see, in such case it sounds like a Breaking change isn't it, project configuration must be updated from 7+ version since compilation will failed in web. Which was not the case before.

I will check what i must change in my configuration. Thank you for the quick reply.

@AlexV525
Copy link
Member

AlexV525 commented Mar 8, 2022

in such case it sounds like a Breaking change isn't it

Not really. We've already been using the extended_image long ago, and according to #227, it's not related to v7.x, so it's not a breaking change.

@LeGoffMael
Copy link
Collaborator Author

After further investigation, you're absolutely right, this error occurs before v7, it is not a breaking change.

I need to found out how i've been able to compile to web since a month without a problem until the update 🤔.

Thank you again for your time.

@AlexV525
Copy link
Member

AlexV525 commented Mar 8, 2022

You can file issues against the extended image library, that would be more reasonable.

@LeGoffMael
Copy link
Collaborator Author

LeGoffMael commented Mar 8, 2022

If someone is facing the same issue, here is how i fixed it in my case:

Avoid error

avoid:

import 'package:wechat_assets_picker/wechat_assets_picker.dart';

try being the most accurate possible (i.e: package:wechat_assets_picker/src/delegates/asset_picker_text_delegate.dart) or use package:photo_manager/photo_manager.dart if possible.

Fix error

in the case you need to import all wechat_assets_picker package or a file that causes the error, you will need to use conditional import.

import 'package:wechat_assets_picker/wechat_assets_picker.dart'
    if (dart.library.html) 'package:my_app/whatever_filename.dart';

in whatever_filename.dart:

/// export `photo_manager` to avoid not found error while compiling in web
export 'package:photo_manager/photo_manager.dart';
// add all needed files that does not causes the error
export 'package:wechat_assets_picker/src/constants/config.dart';

/// Add dumb classes to import for web instead of `wechat_assets_picker` to be able to compile
class AssetPicker {
  static Future<Null> pickAssets(_, {pickerConfig}) async => null;
}

@AlexV525
Copy link
Member

Discussed with @zmtzawqlp offline, we have some class conflicts here. Reopen for applying fixes.

@AlexV525 AlexV525 reopened this Mar 15, 2022
@AlexV525 AlexV525 added s: enhancement New feature or request. b: third party This is a third party package issue. r: extended_image Related to the extended_image package. ⏳WEEK This issue is scheduled to be solved within one week. and removed i: duplicate This issue or pull request already exists. s: invalid This doesn't seem right. labels Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
b: third party This is a third party package issue. r: extended_image Related to the extended_image package. s: enhancement New feature or request. ⏳WEEK This issue is scheduled to be solved within one week.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants