Skip to content

pointer_lock: declare android, ios, windows and linux so pub.dev lists them #80

Open

Description

@kevinkobori

pointer_lock 0.4.2 declares only macos under flutter.plugin.platforms. The web is handled by a conditional export, and every other native target already falls through to MethodChannelPointerLock, whose isSupported is false off macOS (pointer_lock_method_channel.dart:28). So at runtime the package already works everywhere: it locks on macOS and on the web, and elsewhere it says it can't.

pub.dev only reads the pubspec, though, so it lists pointer_lock for macOS alone. Every package that depends on it gets the same listing. For voxel_game 0.4.0-dev, pub.dev's report says Android, iOS, Windows and Linux are "blocked by the pointer_lock package", and its platform tags hold platform:macos only. The kit runs on all five and draws touch controls on phones. Its other packages, which don't depend on pointer_lock, are listed for all five.

The ask: declare android, ios, windows and linux with a Dart-only implementation, for example:

flutter:
  plugin:
    platforms:
      macos:
        pluginClass: PointerLockPlugin
      android:
        dartPluginClass: PointerLockUnsupported
      ios:
        dartPluginClass: PointerLockUnsupported
      windows:
        dartPluginClass: PointerLockUnsupported
      linux:
        dartPluginClass: PointerLockUnsupported

PointerLockUnsupported.registerWith() would set PointerLockPlatform.instance to an implementation whose isSupported is false and whose calls are no-ops, the same answers the method channel already gives off macOS. That needs no native code, and once the platforms are declared pub.dev lists them.

I'm happy to open a PR with this and a test, if you'd take one.

Activity

  1. dzolotov commented on Oct 9, 2026

    @dzolotov
    Collaborator

    Yes, please send the PR. Two things so it lands without a round trip.

    The 1.0 branch already declares windows and linux with native plugins (0.5.0, not on pub.dev yet), so the Dart-only PointerLockUnsupported is needed for android and ios only. Open the PR against main and I'll carry it onto the 1.0 branch.

    CONTRIBUTING asks for the failing test first. A test that instantiates the unsupported backend and checks that isSupported is false and the calls are no-ops is enough; one that reads the pubspec's platform list would be a nice second.

    Thanks for tracing it through voxel_game's pub.dev report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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