Skip to content

Flutter and React Native wrappers for the phone library #78

Backlog

Description

@mwhitham

The iPhone and Android library (#64, #77) gives Swift and Kotlin apps the Athletic Standard record, its checks, its calculations, and its file handling. Apps built with Flutter or React Native cannot use it directly yet. This issue adds a wrapper for each, so those apps get the same rules from the same Rust library.

What each wrapper needs

  • The same rules. Every check, message, and calculation stays in the Rust library. A wrapper only turns calls and values into Dart or TypeScript.
  • Typed records. Every record type, list of allowed values, and calculation answer is a Dart or TypeScript type, generated from the Rust model as the Swift and Kotlin types are (D329). JSON stays available.
  • The same calls as the phone packages: Database, PickedDocument, RecordSnapshot, the extension calls, and the host client with browser sign-in.
  • The same tests. The fixture bundle (D333) runs through each wrapper on an iPhone simulator and an Android emulator, with the desktop round trip.
  • A guide and an example app for each, checked like the Swift and Android guides (mobile/tests/guides.rs).
  • Release. Each wrapper ships with every release and carries its version. Publication stays with the maintainer.

Two ways to build each

  1. Generate the bindings from the same UniFFI interface. Flutter: a UniFFI generator for Dart. React Native: uniffi-bindgen-react-native, which generates TypeScript and C++ bindings. Every record type and call follows the Rust model automatically. The cost is depending on generators that the UniFFI project does not maintain itself.
  2. Wrap the Swift package and the Android library by hand. A Flutter plugin or a React Native module calls the existing Swift and Kotlin code on each platform. It needs no new generator, but every type and call is written twice by hand and must be kept in step.

The plan for this issue should choose one way for each, after a small trial build that checks: the generator's version against UniFFI 0.33, the typed records and errors, and the size of the result.

Open questions

  • The package names on pub.dev and npm. The npm name athleticstandard is the desktop program.
  • Whether a wrapper also needs the in-memory calculations, or only files and the host client.
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

    enhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions