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

feat(package_info_plus)!: Migrate to js_interop for conditional export #2622

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:package_info_plus_platform_interface/package_info_platform_inter

export 'src/package_info_plus_linux.dart';
export 'src/package_info_plus_windows.dart'
if (dart.library.html) 'src/package_info_plus_web.dart';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain this change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to this document you need to use js_interop for conditional import to support WASM,
am I wrong?
https://dart.dev/interop/js-interop/package-web

if (dart.library.js_interop) 'src/package_info_plus_web.dart';

/// Application metadata. Provides application bundle information on iOS and
/// application package information on Android.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter_web_plugins/flutter_web_plugins.dart';
import 'package:http/http.dart';
import 'package:package_info_plus_platform_interface/package_info_data.dart';
import 'package:package_info_plus_platform_interface/package_info_platform_interface.dart';
import 'package:web/helpers.dart' as web;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to leave helpers.dart, because we want to support web 0.3

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I will revert it back if the PR open again

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewer made an alternative PR already

import 'package:web/web.dart' as web;

/// The web implementation of [PackageInfoPlatform].
///
Expand Down
Loading