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

onError, onLoading are discarded #27

Open
jonmountjoy opened this issue Nov 28, 2024 · 0 comments
Open

onError, onLoading are discarded #27

jonmountjoy opened this issue Nov 28, 2024 · 0 comments

Comments

@jonmountjoy
Copy link

Hello!

I'm having a problem getting everything working, but for now I suspect that the onError and onLoading are not working here.

For example, the code of various factory methods looks something like this:

factory GoogleVisionImageBuilder.documentTextDetection({
    Key? key,
    required FutureOr<GoogleVision> googleVision,
    required ImageProvider imageProvider,
    required Widget Function(
      BuildContext,
      FullTextAnnotation?,
    ) builder,
    Widget Function(Object)? onError,
    Widget Function()? onLoading,
    int maxResults = 10,
  }) =>
      GoogleVisionImageBuilder(
        builder: (
          BuildContext context,
          AsyncSnapshot<BatchAnnotateImagesResponse> snapshot,
        ) =>
            builder(
          context,
          snapshot.data?.responses.first.fullTextAnnotation,
        ),
        imageProvider: imageProvider,
        googleVision: googleVision,
        features: GoogleVisionBuilderBase.getFeatures(
            AnnotationType.documentTextDetection, maxResults),
      );

Which looks like it just discards both the onError and onLoading arguments?

I wonder if it should instead be (here, and in all the other variations),

factory GoogleVisionImageBuilder.documentTextDetection({
    Key? key,
    required FutureOr<GoogleVision> googleVision,
    required ImageProvider imageProvider,
    required Widget Function(
      BuildContext,
      FullTextAnnotation?,
    ) builder,
    Widget Function(Object)? onError,
    Widget Function()? onLoading,
    int maxResults = 10,
  }) =>
      GoogleVisionImageBuilder(
        onError: onError,                               /*.  NEW */
        onLoading: onLoading,                  /*.  NEW */
        builder: (
          BuildContext context,
          AsyncSnapshot<BatchAnnotateImagesResponse> snapshot,
        ) =>
            builder(
          context,
          snapshot.data?.responses.first.fullTextAnnotation,
        ),
        imageProvider: imageProvider,
        googleVision: googleVision,
        features: GoogleVisionBuilderBase.getFeatures(
            AnnotationType.documentTextDetection, maxResults),
      );

PS. I couldn't get a local version to work as I'm not familiar with Melos and you have a dependence on collections: 1.19.1 which seems really high and higher than the default 1.18.0 which is pinned to Flutter 3.24.5 which is the latest stable?

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

No branches or pull requests

1 participant