Skip to content

dart:io Platform is not available in Flutter web. #1503

@robertoestivill

Description

@robertoestivill

Flutter useSubscription hook is calling Platform.isAndroid even in the web runtime.

Steps to reproduce

  • Create a flutter web app
  • Add grapqhl_flutter
  • Use the useSubscription hook in a widget
  • Once the code is subscribed, turn off the network.
  • Turn the network back on
  • See the log

Screenshots

Image

Expected behavior
dart:io's Platform class should never be used in the Flutter web context as dart:io is not available.

Offending code here

https://github.com/zino-hofmann/graphql-flutter/blob/main/packages/graphql_flutter/lib/src/widgets/hooks/subscription.dart#L112-L138

Happy to provide a reproducer project/app if you can point me to an open/free demo api with a subscription.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions