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

perf: Enhance Windows package info plugin with error handling and improved documentation #3144

Closed
wants to merge 1 commit into from

Conversation

Piyushhhhh
Copy link

Description

  • Added error handling in the getAll method to catch and report exceptions.
  • Improved documentation comments for PackageInfoPlusWindowsPlugin and its methods.
  • Included additional comments to explain the workaround for UNC path issues on Windows.
  • Ensured consistent formatting and naming conventions throughout the code.
  • Enhanced the _GetOrNull extension to provide a safer way to access list elements.

These updates improve the robustness and maintainability of the Windows-specific implementation of the package_info_plus plugin.

Related Issues

  • [x ] I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • [ x] I titled the PR using Conventional Commits.
  • [ x] I did not modify the CHANGELOG.md nor the plugin version in pubspec.yaml files.
  • [ x] All existing and new tests are passing.
  • [ x] 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 (please indicate that with a ! in the title as explained in Conventional Commits).
  • [ x] No, this is not a breaking change.

…documentation

- Added error handling in the `getAll` method to catch and report exceptions.
- Improved documentation comments for `PackageInfoPlusWindowsPlugin` and its methods.
- Included additional comments to explain the workaround for UNC path issues on Windows.
- Ensured consistent formatting and naming conventions throughout the code.
- Enhanced the `_GetOrNull` extension to provide a safer way to access list elements.

These updates improve the robustness and maintainability of the Windows-specific implementation of the `package_info_plus` plugin.
@Piyushhhhh Piyushhhhh changed the title Enhance Windows package info plugin with error handling and improved documentation perf: Enhance Windows package info plugin with error handling and improved documentation Aug 4, 2024
Copy link
Member

@miquelbeltran miquelbeltran left a comment

Choose a reason for hiding this comment

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

Sorry to say this, but I don't see much value in these changes. The comments changed don't provide any new relevant information, just a rewording, and even remove important context. Same as the error catching implemented.

return Future.value(data);
} catch (e) {
// Handle exceptions, e.g., logging or rethrowing
return Future.error('Failed to retrieve package info: $e');
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure if I see the point of catching an exception and then returning a Future.error. This is the same as just throwing the exception up, except in this case the exception info is lost and instead is wrapped in a String.

Future<PackageInfoData> getAll({String? baseUrl}) {
String resolvedExecutable = Platform.resolvedExecutable;

/// Workaround for https://github.com/dart-lang/sdk/issues/52309
Copy link
Member

Choose a reason for hiding this comment

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

Why did you remove this ticket reference?

@vbuberen
Copy link
Collaborator

vbuberen commented Aug 6, 2024

Agree with what is said above. It seems like some PR for the sake of PR.
Closing it.

@vbuberen vbuberen closed this Aug 6, 2024
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.

3 participants