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

[flutter_svg] Error handling enhancement #8016

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

minhhung2556
Copy link

@minhhung2556 minhhung2556 commented Nov 4, 2024

Title

  • Error handling when loading and parsing SVG files from anywhere.
  • Expose errorBuilder to build a widget that will be shown if it fails to parse an SVG picture.

Purpose

To fix these related issues below

My related PRs at the old repositories

Changes Made

  • Catch error cases and return results to SVGPicture.
  • Expose errorWidgetBuilder.
  • Write more unit tests.
  • Update example.

Testing

  • Already tested by example and unit test in flutter_svg

Impact

  • This change should not affect other parts of the library.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Copy link

google-cla bot commented Nov 4, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@stuartmorgan
Copy link
Contributor

Thanks for the submission!

In the future, please do not delete the checklist that is in the PR template; it is there for a reason. This PR is missing required elements described in the checklist (I’ve restored it to the PR description), which need to be addressed before it moves forward with review.

I am marking the PR as a Draft. Please review the checklist, updating the PR as appropriate, and when that’s complete please feel free to mark the PR as ready for review.

@stuartmorgan stuartmorgan marked this pull request as draft November 4, 2024 17:46
@minhhung2556 minhhung2556 changed the title Error handling enhancement [flutter_svg] Error handling enhancement Nov 4, 2024
@minhhung2556
Copy link
Author

@stuartmorgan thanks for your advice, I've just updated it, please help me check if it is ok now.

@stuartmorgan
Copy link
Contributor

@minhhung2556 The PR is currently failing many CI checks; you can look at Details > View more details > stdout to see what the issues are and address them.

@@ -674,7 +686,7 @@ class VectorGraphicUtilities {
///
/// It is the caller's responsibility to handle disposing the picture when
/// they are done with it.
Future<PictureInfo> loadPicture(
Future<PictureInfo?> loadPicture(
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like a breaking change, so will need to be evaluated in the context of flutter/flutter#157626

If the decision there is (as I hope) to start using semver for vector_graphics*, this would need to be versioned accordingly, or would need a non-breaking alternative.

Copy link
Member

Choose a reason for hiding this comment

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

Rather than making it null, we can throw/catch an exception I think.

@minhhung2556
Copy link
Author

@minhhung2556 The PR is currently failing many CI checks; you can look at Details > View more details > stdout to see what the issues are and address them.

I think it failed because of this commit: 9672f24

Regarding your review, I think I need to separate into 2 PRs: 1 for vector_graphics and 1 for flutter_svg

This looks like a breaking change, so will need to be evaluated in the context of flutter/flutter#157626

If the decision there is (as I hope) to start using semver for vector_graphics*, this would need to be versioned accordingly, or would need a non-breaking alternative.

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