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): Added toMap method #1926

Merged
merged 10 commits into from
Jun 29, 2023
Merged

feat(package_info_plus): Added toMap method #1926

merged 10 commits into from
Jun 29, 2023

Conversation

mcorbelli
Copy link
Contributor

@mcorbelli mcorbelli commented Jun 23, 2023

Description

This PR adds a toMap() function to the PackageInfo class in the package_info_plus plugin. Previously, this functionality was missing. The toMap() function returns a map representation of the PackageInfo instance. Notably, the buildSignature and installerStore fields are included in the map only if they are non-null and non-empty. This change ensures that the returned map only contains meaningful and useful data.

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I titled the PR using Conventional Commits.
  • I did not modify the CHANGELOG.md nor the plugin version in pubspec.yaml files.
  • All existing and new tests are passing.
  • The analyzer (flutter analyze) does not report any problems on my PR.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

@mcorbelli mcorbelli changed the title [package_info_plus] added toMap method feat(package_info_plus): Added toMap method Jun 23, 2023
@nohli
Copy link
Member

nohli commented Jun 24, 2023

While I like it, we deprecated toMap() from device_info_plus last year.
#950 (comment)
#949 (comment)
#1142
#1292

@mcorbelli
Copy link
Contributor Author

I see the problem, can I create a data getter that retrieves data from the toMap as done for device_info_plus? @nohli

@nohli
Copy link
Member

nohli commented Jun 24, 2023

Thanks for the change. Makes sense to me, since we have it device_info_plus, too.

Left a code suggestion.

mcorbelli and others added 2 commits June 25, 2023 20:38
…plus.dart

Co-authored-by: Joachim Nohl <43643339+nohli@users.noreply.github.com>
@nohli
Copy link
Member

nohli commented Jun 26, 2023

Great, I like it.

Would you mind adding tests? Can set the data with setMockInitialValues and then expect the correct map (also with buildSignature and installerStore being empty/null)?

dart format -l 80 . can fix the format issue

Corbelli Mattia and others added 2 commits June 26, 2023 13:46
Copy link
Member

@nohli nohli left a comment

Choose a reason for hiding this comment

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

LGTM!

@nohli nohli merged commit 4696ff4 into fluttercommunity:main Jun 29, 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

Successfully merging this pull request may close these issues.

2 participants