diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 72283ea..6cf545d 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -72,17 +72,17 @@ jobs: run: bash tool/build_linux_consumer.sh linux-minimum-sdk-consumer: - name: Linux minimum-SDK tests + consumer (Dart 3.6) + name: Linux minimum-SDK tests + consumer (Dart 3.13) runs-on: ubuntu-latest steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - # Flutter 3.27.0 ships Dart 3.6.0, the package's declared SDK minimum. + # Flutter 3.47.7 ships Dart 3.13, the package's declared SDK minimum. # Build the same real consumer fixture rather than duplicating pub syntax. - uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0 with: channel: stable - flutter-version: '3.27.0' + flutter-version: '3.47.7' - name: Install Linux build and native test dependencies run: | @@ -93,7 +93,7 @@ jobs: run: flutter precache --linux # Bootstrap the Linux dependency closure only: Android and its example - # have newer SDK floors and are covered by the stable/native jobs. + # are covered by the stable/native jobs. - name: Link Linux workspace dependencies run: dart run melos bootstrap --scope=simple_query_linux --include-dependencies diff --git a/.gitignore b/.gitignore index 60fb169..2fc3b5f 100644 --- a/.gitignore +++ b/.gitignore @@ -32,11 +32,6 @@ migrate_working_dir/ .pub/ build/ **/build/ -# Lockfiles for federated library packages — consumers' lockfile -# is what matters; ours would mask reproducibility drift in CI. -# Keep in sync with simple-permissions / simple-sms / simple-telephony / -# simple-messages, all of which gitignore pubspec.lock. -pubspec.lock # Symbolication / obfuscation app.*.symbols diff --git a/AGENTS.md b/AGENTS.md index 5534795..d2464e9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -32,11 +32,8 @@ implements it, and `simple_query` is the public surface. ## Build · test · verify Use released stable Flutter **3.47 or later** for workspace verification; -**melos** drives the workspace. SDK floors are package-specific: -`simple_query_android` requires Dart `^3.12.0` / Flutter `>=3.44.0`, and -the built-in-Kotlin example requires Dart `^3.12.0` / Flutter `>=3.47.0`. -Untouched packages retain their own declared floors (generally Dart `^3.6.0`); -consult each `pubspec.yaml` rather than applying one workspace-wide floor. +**melos** drives the workspace. Every package and the example require Dart `^3.13.0` / Flutter `>=3.47.7` +(UNFY-412). The example's Android toolchain is declared in `example/android/settings.gradle.kts` and the Gradle wrapper properties. @@ -59,6 +56,12 @@ flutter test See `melos.yaml` for the workspace scripts. +Every package and the example commits its `pubspec.lock` (CQS-DEP-02), +resolved after `melos bootstrap`, as CI resolves it. When `flutter pub get` +or `flutter pub upgrade` changes a lockfile, including after a release +changes the linked package versions, commit it. pub leaves `pubspec.lock` +out of published packages. + **When you touch `packages/simple_query_android/android/` (Kotlin), also run the native gate.** `flutter test` never compiles or tests that Kotlin. The native unit tests run through the *example app's* Gradle (a bare diff --git a/example/lib/main.dart b/example/lib/main.dart index bd5e7be..d07c986 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,6 +1,6 @@ import 'dart:io'; -import 'package:flutter/material.dart'; +import 'package:material_ui/material_ui.dart'; import 'package:simple_query/simple_query.dart'; void main() { diff --git a/example/pubspec.lock b/example/pubspec.lock new file mode 100644 index 0000000..58b6f58 --- /dev/null +++ b/example/pubspec.lock @@ -0,0 +1,369 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + clock: + dependency: transitive + description: + name: clock + sha256: e51d50bca3217c9a9fa2b41a30e4a38971133f5f9ec7a3d57bae095007f1d28e + url: "https://pub.dev" + source: hosted + version: "1.1.3" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + cupertino_ui: + dependency: transitive + description: + name: cupertino_ui + sha256: c3eaf7f5bdfee36deb0b14a4cbf7602f1b6b8d8b8576b81f38fc08c25881c94c + url: "https://pub.dev" + source: hosted + version: "1.1.7" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_driver: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_localizations: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + fuchsia_remote_debug_protocol: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + integration_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + intl: + dependency: transitive + description: + name: intl + sha256: "1ca20c894b1717686a2319b8548763d812bc0aabdac580420a44c5178c57a867" + url: "https://pub.dev" + source: hosted + version: "0.20.3" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + listen: + dependency: transitive + description: + name: listen + sha256: "47501a08016a43fcad79252439d723f50f14f88fa7bfd8a177e0a417e5c9e1f2" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd" + url: "https://pub.dev" + source: hosted + version: "0.12.20" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + material_ui: + dependency: "direct main" + description: + name: material_ui + sha256: a6b19012df437a356cbc01f8ea22a105e07194c47c9a6009da0032a0ce35c4ab + url: "https://pub.dev" + source: hosted + version: "1.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" + url: "https://pub.dev" + source: hosted + version: "1.19.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + platform: + dependency: transitive + description: + name: platform + sha256: a36d119c13416516a7b5913fbe8af8531e11633d784c550b2125f76c758524ec + url: "https://pub.dev" + source: hosted + version: "3.2.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + process: + dependency: transitive + description: + name: process + sha256: "4242ba3508d37e01808bdf71ad1d5bb93a8d671bf2e7450e6b1b353fb0808891" + url: "https://pub.dev" + source: hosted + version: "5.0.6" + simple_query: + dependency: "direct main" + description: + path: "../packages/simple_query" + relative: true + source: path + version: "0.3.0" + simple_query_android: + dependency: "direct overridden" + description: + path: "../packages/simple_query_android" + relative: true + source: path + version: "0.3.0" + simple_query_ios: + dependency: "direct overridden" + description: + path: "../packages/simple_query_ios" + relative: true + source: path + version: "0.3.0" + simple_query_linux: + dependency: "direct overridden" + description: + path: "../packages/simple_query_linux" + relative: true + source: path + version: "0.3.0" + simple_query_macos: + dependency: "direct overridden" + description: + path: "../packages/simple_query_macos" + relative: true + source: path + version: "0.3.0" + simple_query_platform_interface: + dependency: "direct overridden" + description: + path: "../packages/simple_query_platform_interface" + relative: true + source: path + version: "0.2.2" + simple_query_shared: + dependency: "direct overridden" + description: + path: "../packages/simple_query_shared" + relative: true + source: path + version: "0.3.0" + simple_query_windows: + dependency: "direct overridden" + description: + path: "../packages/simple_query_windows" + relative: true + source: path + version: "0.3.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490" + url: "https://pub.dev" + source: hosted + version: "1.12.2" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + sync_http: + dependency: transitive + description: + name: sync_http + sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961" + url: "https://pub.dev" + source: hosted + version: "0.3.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "0a10344e901e5b2e63819567951cb6a06673ed6b84f40462188ff5a0c41f371f" + url: "https://pub.dev" + source: hosted + version: "0.7.14" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: fa49e1674cb84acb900141714e6c6e1f9ae099827c24d141430ff6819db4e1bc + url: "https://pub.dev" + source: hosted + version: "2.4.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "89b11d62e1040ee681af3b4f1c97a803ecbf010c6e8b9c5896ee5b08c3bf7b78" + url: "https://pub.dev" + source: hosted + version: "15.4.0" + web: + dependency: transitive + description: + name: web + sha256: e119e82ac4795c7925103b7cf3768191f33941b99e7ccffbd6c645201d9f606b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + webdriver: + dependency: transitive + description: + name: webdriver + sha256: "28b82ec894fed45dd71c23ba62d1af973ed97dd59a4f5790a4d38b0b13e5657e" + url: "https://pub.dev" + source: hosted + version: "3.2.0" +sdks: + dart: ">=3.13.0 <4.0.0" + flutter: ">=3.47.7" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index fb52934..346b55a 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -3,21 +3,22 @@ description: Example app for simple_query federated plugin. publish_to: none environment: - sdk: ^3.12.0 - flutter: ">=3.47.0" + sdk: ^3.13.0 + flutter: ">=3.47.7" dependencies: flutter: sdk: flutter simple_query: path: ../packages/simple_query + material_ui: 1.11.1 dev_dependencies: flutter_test: sdk: flutter integration_test: sdk: flutter - flutter_lints: ^5.0.0 + flutter_lints: 6.0.0 flutter: uses-material-design: true diff --git a/packages/simple_query/CHANGELOG.md b/packages/simple_query/CHANGELOG.md index 3f1dd31..ae6c3a8 100644 --- a/packages/simple_query/CHANGELOG.md +++ b/packages/simple_query/CHANGELOG.md @@ -1,5 +1,6 @@ ## Unreleased +- **Breaking:** Requires Flutter 3.47.7 / Dart 3.13. Release as a breaking version (the next 0.x minor) (UNFY-412). - **Behavior change (Android):** `openBinary()` now opens the provider content before it returns, so a failure to open it (`permissionDenied`, `unavailable`, or `unavailable` with `reason: noStream`) throws from `openBinary()` instead of yielding an empty stream (UNFY-364). - **Behavior change (Android):** `closeBinary()`, `BinaryContent.close()` and `withBinaryContent` throw a failed background copy as `SimpleQueryError` (UNFY-365). diff --git a/packages/simple_query/pubspec.lock b/packages/simple_query/pubspec.lock new file mode 100644 index 0000000..8094872 --- /dev/null +++ b/packages/simple_query/pubspec.lock @@ -0,0 +1,270 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + clock: + dependency: transitive + description: + name: clock + sha256: e51d50bca3217c9a9fa2b41a30e4a38971133f5f9ec7a3d57bae095007f1d28e + url: "https://pub.dev" + source: hosted + version: "1.1.3" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + listen: + dependency: transitive + description: + name: listen + sha256: "47501a08016a43fcad79252439d723f50f14f88fa7bfd8a177e0a417e5c9e1f2" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd" + url: "https://pub.dev" + source: hosted + version: "0.12.20" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + meta: + dependency: transitive + description: + name: meta + sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" + url: "https://pub.dev" + source: hosted + version: "1.19.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + plugin_platform_interface: + dependency: "direct dev" + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + simple_query_android: + dependency: "direct main" + description: + path: "../simple_query_android" + relative: true + source: path + version: "0.3.0" + simple_query_ios: + dependency: "direct main" + description: + path: "../simple_query_ios" + relative: true + source: path + version: "0.3.0" + simple_query_linux: + dependency: "direct main" + description: + path: "../simple_query_linux" + relative: true + source: path + version: "0.3.0" + simple_query_macos: + dependency: "direct main" + description: + path: "../simple_query_macos" + relative: true + source: path + version: "0.3.0" + simple_query_platform_interface: + dependency: "direct main" + description: + path: "../simple_query_platform_interface" + relative: true + source: path + version: "0.2.2" + simple_query_shared: + dependency: "direct overridden" + description: + path: "../simple_query_shared" + relative: true + source: path + version: "0.3.0" + simple_query_windows: + dependency: "direct main" + description: + path: "../simple_query_windows" + relative: true + source: path + version: "0.3.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490" + url: "https://pub.dev" + source: hosted + version: "1.12.2" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "0a10344e901e5b2e63819567951cb6a06673ed6b84f40462188ff5a0c41f371f" + url: "https://pub.dev" + source: hosted + version: "0.7.14" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: fa49e1674cb84acb900141714e6c6e1f9ae099827c24d141430ff6819db4e1bc + url: "https://pub.dev" + source: hosted + version: "2.4.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "89b11d62e1040ee681af3b4f1c97a803ecbf010c6e8b9c5896ee5b08c3bf7b78" + url: "https://pub.dev" + source: hosted + version: "15.4.0" +sdks: + dart: ">=3.13.0 <4.0.0" + flutter: ">=3.47.7" diff --git a/packages/simple_query/pubspec.yaml b/packages/simple_query/pubspec.yaml index c910d46..234faf0 100644 --- a/packages/simple_query/pubspec.yaml +++ b/packages/simple_query/pubspec.yaml @@ -13,8 +13,8 @@ topics: - files environment: - sdk: ^3.6.0 - flutter: '>=3.24.0' + sdk: ^3.13.0 + flutter: '>=3.47.7' dependencies: flutter: @@ -36,8 +36,8 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^5.0.0 - plugin_platform_interface: ^2.1.8 + flutter_lints: 6.0.0 + plugin_platform_interface: 2.1.8 flutter: plugin: diff --git a/packages/simple_query_android/CHANGELOG.md b/packages/simple_query_android/CHANGELOG.md index f346741..e932b1f 100644 --- a/packages/simple_query_android/CHANGELOG.md +++ b/packages/simple_query_android/CHANGELOG.md @@ -1,5 +1,7 @@ ## Unreleased +- **Breaking:** Requires Flutter 3.47.7 / Dart 3.13. Release as a breaking version (the next 0.x minor) (UNFY-412). +- Regenerates the platform channel code with Pigeon 30 (UNFY-412). - **Behavior change (Android):** `openBinary()` now opens the provider content before it returns, so a failure to open it (`permissionDenied`, `unavailable`, or `unavailable` with `reason: noStream`) throws from `openBinary()` instead of yielding an empty stream (UNFY-364). - A host query with a `limit` and no sort order now sorts by `_id ASC`, instead of sending the provider invalid SQL that failed as `invalidQuery`. This fixes `queryWithJoins` with a `limit` and no `sortOrder` (UNFY-301). - **Behavior change:** `closeBinary()` now throws a failed background copy as its mapped `SimpleQueryError`, so end-of-stream plus a normal `closeBinary()` means the content is complete. The unused `onStreamError` Pigeon callback is removed (UNFY-365). diff --git a/packages/simple_query_android/android/src/main/kotlin/io/simplezen/simple_query/Query.g.kt b/packages/simple_query_android/android/src/main/kotlin/io/simplezen/simple_query/Query.g.kt index 985a044..6e0bfbd 100644 --- a/packages/simple_query_android/android/src/main/kotlin/io/simplezen/simple_query/Query.g.kt +++ b/packages/simple_query_android/android/src/main/kotlin/io/simplezen/simple_query/Query.g.kt @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v22.7.4), do not edit directly. +// Autogenerated from Pigeon (v30.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon @file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") @@ -13,29 +13,175 @@ import io.flutter.plugin.common.StandardMethodCodec import io.flutter.plugin.common.StandardMessageCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer +private object QueryPigeonUtils { -private fun wrapResult(result: Any?): List { - return listOf(result) -} + fun createConnectionError(channelName: String): QueryFlutterError { + return QueryFlutterError("channel-error", "Unable to establish connection on channel: '$channelName'.", "") } -private fun wrapError(exception: Throwable): List { - return if (exception is QueryFlutterError) { - listOf( - exception.code, - exception.message, - exception.details - ) - } else { - listOf( - exception.javaClass.simpleName, - exception.toString(), - "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) - ) + fun wrapResult(result: Any?): List { + return listOf(result) } -} -private fun createConnectionError(channelName: String): QueryFlutterError { - return QueryFlutterError("channel-error", "Unable to establish connection on channel: '$channelName'.", "")} + fun wrapError(exception: Throwable): List { + return if (exception is QueryFlutterError) { + listOf( + exception.code, + exception.message, + exception.details + ) + } else { + listOf( + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) + ) + } + } + fun doubleEquals(a: Double, b: Double): Boolean { + // Normalize -0.0 to 0.0 and handle NaN equality. + return (if (a == 0.0) 0.0 else a) == (if (b == 0.0) 0.0 else b) || (a.isNaN() && b.isNaN()) + } + + fun floatEquals(a: Float, b: Float): Boolean { + // Normalize -0.0 to 0.0 and handle NaN equality. + return (if (a == 0.0f) 0.0f else a) == (if (b == 0.0f) 0.0f else b) || (a.isNaN() && b.isNaN()) + } + + fun doubleHash(d: Double): Int { + // Normalize -0.0 to 0.0 and handle NaN to ensure consistent hash codes. + val normalized = if (d == 0.0) 0.0 else d + val bits = java.lang.Double.doubleToLongBits(normalized) + return (bits xor (bits ushr 32)).toInt() + } + + fun floatHash(f: Float): Int { + // Normalize -0.0 to 0.0 and handle NaN to ensure consistent hash codes. + val normalized = if (f == 0.0f) 0.0f else f + return java.lang.Float.floatToIntBits(normalized) + } + + fun deepEquals(a: Any?, b: Any?): Boolean { + if (a === b) { + return true + } + if (a == null || b == null) { + return false + } + if (a is ByteArray && b is ByteArray) { + return a.contentEquals(b) + } + if (a is IntArray && b is IntArray) { + return a.contentEquals(b) + } + if (a is LongArray && b is LongArray) { + return a.contentEquals(b) + } + if (a is DoubleArray && b is DoubleArray) { + if (a.size != b.size) return false + for (i in a.indices) { + if (!doubleEquals(a[i], b[i])) return false + } + return true + } + if (a is FloatArray && b is FloatArray) { + if (a.size != b.size) return false + for (i in a.indices) { + if (!floatEquals(a[i], b[i])) return false + } + return true + } + if (a is Array<*> && b is Array<*>) { + if (a.size != b.size) return false + for (i in a.indices) { + if (!deepEquals(a[i], b[i])) return false + } + return true + } + if (a is List<*> && b is List<*>) { + if (a.size != b.size) return false + val iterA = a.iterator() + val iterB = b.iterator() + while (iterA.hasNext() && iterB.hasNext()) { + if (!deepEquals(iterA.next(), iterB.next())) return false + } + return true + } + if (a is Map<*, *> && b is Map<*, *>) { + if (a.size != b.size) return false + for (entry in a) { + val key = entry.key + var found = false + for (bEntry in b) { + if (deepEquals(key, bEntry.key)) { + if (deepEquals(entry.value, bEntry.value)) { + found = true + break + } else { + return false + } + } + } + if (!found) return false + } + return true + } + if (a is Double && b is Double) { + return doubleEquals(a, b) + } + if (a is Float && b is Float) { + return floatEquals(a, b) + } + return a == b + } + + fun deepHash(value: Any?): Int { + return when (value) { + null -> 0 + is ByteArray -> value.contentHashCode() + is IntArray -> value.contentHashCode() + is LongArray -> value.contentHashCode() + is DoubleArray -> { + var result = 1 + for (item in value) { + result = 31 * result + doubleHash(item) + } + result + } + is FloatArray -> { + var result = 1 + for (item in value) { + result = 31 * result + floatHash(item) + } + result + } + is Array<*> -> { + var result = 1 + for (item in value) { + result = 31 * result + deepHash(item) + } + result + } + is List<*> -> { + var result = 1 + for (item in value) { + result = 31 * result + deepHash(item) + } + result + } + is Map<*, *> -> { + var result = 0 + for (entry in value) { + result += ((deepHash(entry.key) * 31) xor deepHash(entry.value)) + } + result + } + is Double -> doubleHash(value) + is Float -> floatHash(value) + else -> value.hashCode() + } + } + +} /** * Error class for passing custom error details to Flutter via a thrown PlatformException. @@ -47,7 +193,7 @@ class QueryFlutterError ( val code: String, override val message: String? = null, val details: Any? = null -) : Throwable() +) : RuntimeException() /** Type of content change observed by ContentObserver. */ enum class ContentChangeType(val raw: Int) { @@ -57,8 +203,10 @@ enum class ContentChangeType(val raw: Int) { UNKNOWN(3); companion object { + private val pigeonValues = values() + fun ofRaw(raw: Int): ContentChangeType? { - return values().firstOrNull { it.raw == raw } + return pigeonValues.getOrNull(raw) } } } @@ -71,8 +219,10 @@ enum class BatchOperationType(val raw: Int) { ASSERT_QUERY(3); companion object { + private val pigeonValues = values() + fun ofRaw(raw: Int): BatchOperationType? { - return values().firstOrNull { it.raw == raw } + return pigeonValues.getOrNull(raw) } } } @@ -122,6 +272,31 @@ data class QueryRequest ( offset, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as QueryRequest + return QueryPigeonUtils.deepEquals(this.contentUri, other.contentUri) && QueryPigeonUtils.deepEquals(this.projection, other.projection) && QueryPigeonUtils.deepEquals(this.selection, other.selection) && QueryPigeonUtils.deepEquals(this.selectionArgs, other.selectionArgs) && QueryPigeonUtils.deepEquals(this.sortOrder, other.sortOrder) && QueryPigeonUtils.deepEquals(this.limit, other.limit) && QueryPigeonUtils.deepEquals(this.offset, other.offset) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.contentUri) + result = 31 * result + QueryPigeonUtils.deepHash(this.projection) + result = 31 * result + QueryPigeonUtils.deepHash(this.selection) + result = 31 * result + QueryPigeonUtils.deepHash(this.selectionArgs) + result = 31 * result + QueryPigeonUtils.deepHash(this.sortOrder) + result = 31 * result + QueryPigeonUtils.deepHash(this.limit) + result = 31 * result + QueryPigeonUtils.deepHash(this.offset) + return result + } + override fun toString(): String { + return "QueryRequest(contentUri=$contentUri, projection=$projection, selection=$selection, selectionArgs=$selectionArgs, sortOrder=$sortOrder, limit=$limit, offset=$offset)" + } } /** @@ -158,6 +333,27 @@ data class QueryResponse ( columnNames, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as QueryResponse + return QueryPigeonUtils.deepEquals(this.rows, other.rows) && QueryPigeonUtils.deepEquals(this.rowCount, other.rowCount) && QueryPigeonUtils.deepEquals(this.columnNames, other.columnNames) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.rows) + result = 31 * result + QueryPigeonUtils.deepHash(this.rowCount) + result = 31 * result + QueryPigeonUtils.deepHash(this.columnNames) + return result + } + override fun toString(): String { + return "QueryResponse(rows=$rows, rowCount=$rowCount, columnNames=$columnNames)" + } } /** @@ -184,6 +380,26 @@ data class InsertRequest ( values, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as InsertRequest + return QueryPigeonUtils.deepEquals(this.contentUri, other.contentUri) && QueryPigeonUtils.deepEquals(this.values, other.values) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.contentUri) + result = 31 * result + QueryPigeonUtils.deepHash(this.values) + return result + } + override fun toString(): String { + return "InsertRequest(contentUri=$contentUri, values=$values)" + } } /** @@ -210,6 +426,26 @@ data class BulkInsertRequest ( valuesList, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as BulkInsertRequest + return QueryPigeonUtils.deepEquals(this.contentUri, other.contentUri) && QueryPigeonUtils.deepEquals(this.valuesList, other.valuesList) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.contentUri) + result = 31 * result + QueryPigeonUtils.deepHash(this.valuesList) + return result + } + override fun toString(): String { + return "BulkInsertRequest(contentUri=$contentUri, valuesList=$valuesList)" + } } /** @@ -244,6 +480,28 @@ data class UpdateRequest ( selectionArgs, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as UpdateRequest + return QueryPigeonUtils.deepEquals(this.contentUri, other.contentUri) && QueryPigeonUtils.deepEquals(this.values, other.values) && QueryPigeonUtils.deepEquals(this.selection, other.selection) && QueryPigeonUtils.deepEquals(this.selectionArgs, other.selectionArgs) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.contentUri) + result = 31 * result + QueryPigeonUtils.deepHash(this.values) + result = 31 * result + QueryPigeonUtils.deepHash(this.selection) + result = 31 * result + QueryPigeonUtils.deepHash(this.selectionArgs) + return result + } + override fun toString(): String { + return "UpdateRequest(contentUri=$contentUri, values=$values, selection=$selection, selectionArgs=$selectionArgs)" + } } /** @@ -274,6 +532,27 @@ data class DeleteRequest ( selectionArgs, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as DeleteRequest + return QueryPigeonUtils.deepEquals(this.contentUri, other.contentUri) && QueryPigeonUtils.deepEquals(this.selection, other.selection) && QueryPigeonUtils.deepEquals(this.selectionArgs, other.selectionArgs) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.contentUri) + result = 31 * result + QueryPigeonUtils.deepHash(this.selection) + result = 31 * result + QueryPigeonUtils.deepHash(this.selectionArgs) + return result + } + override fun toString(): String { + return "DeleteRequest(contentUri=$contentUri, selection=$selection, selectionArgs=$selectionArgs)" + } } /** @@ -322,6 +601,32 @@ data class BatchOperation ( backReferenceColumn, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as BatchOperation + return QueryPigeonUtils.deepEquals(this.type, other.type) && QueryPigeonUtils.deepEquals(this.contentUri, other.contentUri) && QueryPigeonUtils.deepEquals(this.values, other.values) && QueryPigeonUtils.deepEquals(this.selection, other.selection) && QueryPigeonUtils.deepEquals(this.selectionArgs, other.selectionArgs) && QueryPigeonUtils.deepEquals(this.expectedCount, other.expectedCount) && QueryPigeonUtils.deepEquals(this.backReferenceIndex, other.backReferenceIndex) && QueryPigeonUtils.deepEquals(this.backReferenceColumn, other.backReferenceColumn) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.type) + result = 31 * result + QueryPigeonUtils.deepHash(this.contentUri) + result = 31 * result + QueryPigeonUtils.deepHash(this.values) + result = 31 * result + QueryPigeonUtils.deepHash(this.selection) + result = 31 * result + QueryPigeonUtils.deepHash(this.selectionArgs) + result = 31 * result + QueryPigeonUtils.deepHash(this.expectedCount) + result = 31 * result + QueryPigeonUtils.deepHash(this.backReferenceIndex) + result = 31 * result + QueryPigeonUtils.deepHash(this.backReferenceColumn) + return result + } + override fun toString(): String { + return "BatchOperation(type=$type, contentUri=$contentUri, values=$values, selection=$selection, selectionArgs=$selectionArgs, expectedCount=$expectedCount, backReferenceIndex=$backReferenceIndex, backReferenceColumn=$backReferenceColumn)" + } } /** @@ -349,6 +654,26 @@ data class BatchRequest ( operations, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as BatchRequest + return QueryPigeonUtils.deepEquals(this.authority, other.authority) && QueryPigeonUtils.deepEquals(this.operations, other.operations) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.authority) + result = 31 * result + QueryPigeonUtils.deepHash(this.operations) + return result + } + override fun toString(): String { + return "BatchRequest(authority=$authority, operations=$operations)" + } } /** @@ -376,6 +701,26 @@ data class BatchOperationResult ( count, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as BatchOperationResult + return QueryPigeonUtils.deepEquals(this.uri, other.uri) && QueryPigeonUtils.deepEquals(this.count, other.count) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.uri) + result = 31 * result + QueryPigeonUtils.deepHash(this.count) + return result + } + override fun toString(): String { + return "BatchOperationResult(uri=$uri, count=$count)" + } } /** @@ -425,6 +770,32 @@ data class JoinSpec ( sortOrder, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as JoinSpec + return QueryPigeonUtils.deepEquals(this.name, other.name) && QueryPigeonUtils.deepEquals(this.contentUri, other.contentUri) && QueryPigeonUtils.deepEquals(this.foreignKeyColumn, other.foreignKeyColumn) && QueryPigeonUtils.deepEquals(this.parentKeyColumn, other.parentKeyColumn) && QueryPigeonUtils.deepEquals(this.projection, other.projection) && QueryPigeonUtils.deepEquals(this.selection, other.selection) && QueryPigeonUtils.deepEquals(this.selectionArgs, other.selectionArgs) && QueryPigeonUtils.deepEquals(this.sortOrder, other.sortOrder) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.name) + result = 31 * result + QueryPigeonUtils.deepHash(this.contentUri) + result = 31 * result + QueryPigeonUtils.deepHash(this.foreignKeyColumn) + result = 31 * result + QueryPigeonUtils.deepHash(this.parentKeyColumn) + result = 31 * result + QueryPigeonUtils.deepHash(this.projection) + result = 31 * result + QueryPigeonUtils.deepHash(this.selection) + result = 31 * result + QueryPigeonUtils.deepHash(this.selectionArgs) + result = 31 * result + QueryPigeonUtils.deepHash(this.sortOrder) + return result + } + override fun toString(): String { + return "JoinSpec(name=$name, contentUri=$contentUri, foreignKeyColumn=$foreignKeyColumn, parentKeyColumn=$parentKeyColumn, projection=$projection, selection=$selection, selectionArgs=$selectionArgs, sortOrder=$sortOrder)" + } } /** @@ -452,6 +823,26 @@ data class JoinQueryRequest ( joins, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as JoinQueryRequest + return QueryPigeonUtils.deepEquals(this.primary, other.primary) && QueryPigeonUtils.deepEquals(this.joins, other.joins) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.primary) + result = 31 * result + QueryPigeonUtils.deepHash(this.joins) + return result + } + override fun toString(): String { + return "JoinQueryRequest(primary=$primary, joins=$joins)" + } } /** @@ -485,6 +876,26 @@ data class JoinedRow ( related, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as JoinedRow + return QueryPigeonUtils.deepEquals(this.data, other.data) && QueryPigeonUtils.deepEquals(this.related, other.related) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.data) + result = 31 * result + QueryPigeonUtils.deepHash(this.related) + return result + } + override fun toString(): String { + return "JoinedRow(data=$data, related=$related)" + } } /** @@ -510,6 +921,26 @@ data class JoinQueryResponse ( rowCount, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as JoinQueryResponse + return QueryPigeonUtils.deepEquals(this.rows, other.rows) && QueryPigeonUtils.deepEquals(this.rowCount, other.rowCount) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.rows) + result = 31 * result + QueryPigeonUtils.deepHash(this.rowCount) + return result + } + override fun toString(): String { + return "JoinQueryResponse(rows=$rows, rowCount=$rowCount)" + } } /** @@ -545,6 +976,28 @@ data class StreamDescriptor ( size, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as StreamDescriptor + return QueryPigeonUtils.deepEquals(this.streamId, other.streamId) && QueryPigeonUtils.deepEquals(this.pipePath, other.pipePath) && QueryPigeonUtils.deepEquals(this.mimeType, other.mimeType) && QueryPigeonUtils.deepEquals(this.size, other.size) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.streamId) + result = 31 * result + QueryPigeonUtils.deepHash(this.pipePath) + result = 31 * result + QueryPigeonUtils.deepHash(this.mimeType) + result = 31 * result + QueryPigeonUtils.deepHash(this.size) + return result + } + override fun toString(): String { + return "StreamDescriptor(streamId=$streamId, pipePath=$pipePath, mimeType=$mimeType, size=$size)" + } } /** @@ -588,6 +1041,29 @@ data class ContentChangeEvent ( selfChange, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as ContentChangeEvent + return QueryPigeonUtils.deepEquals(this.observerId, other.observerId) && QueryPigeonUtils.deepEquals(this.uri, other.uri) && QueryPigeonUtils.deepEquals(this.changeType, other.changeType) && QueryPigeonUtils.deepEquals(this.flags, other.flags) && QueryPigeonUtils.deepEquals(this.selfChange, other.selfChange) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.observerId) + result = 31 * result + QueryPigeonUtils.deepHash(this.uri) + result = 31 * result + QueryPigeonUtils.deepHash(this.changeType) + result = 31 * result + QueryPigeonUtils.deepHash(this.flags) + result = 31 * result + QueryPigeonUtils.deepHash(this.selfChange) + return result + } + override fun toString(): String { + return "ContentChangeEvent(observerId=$observerId, uri=$uri, changeType=$changeType, flags=$flags, selfChange=$selfChange)" + } } /** @@ -614,6 +1090,26 @@ data class ObserverRequest ( notifyForDescendants, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as ObserverRequest + return QueryPigeonUtils.deepEquals(this.contentUri, other.contentUri) && QueryPigeonUtils.deepEquals(this.notifyForDescendants, other.notifyForDescendants) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.contentUri) + result = 31 * result + QueryPigeonUtils.deepHash(this.notifyForDescendants) + return result + } + override fun toString(): String { + return "ObserverRequest(contentUri=$contentUri, notifyForDescendants=$notifyForDescendants)" + } } /** @@ -637,6 +1133,25 @@ data class TypeResponse ( mimeType, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as TypeResponse + return QueryPigeonUtils.deepEquals(this.mimeType, other.mimeType) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.mimeType) + return result + } + override fun toString(): String { + return "TypeResponse(mimeType=$mimeType)" + } } /** @@ -668,6 +1183,28 @@ data class ProviderCallRequest ( extras, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as ProviderCallRequest + return QueryPigeonUtils.deepEquals(this.authority, other.authority) && QueryPigeonUtils.deepEquals(this.method, other.method) && QueryPigeonUtils.deepEquals(this.arg, other.arg) && QueryPigeonUtils.deepEquals(this.extras, other.extras) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.authority) + result = 31 * result + QueryPigeonUtils.deepHash(this.method) + result = 31 * result + QueryPigeonUtils.deepHash(this.arg) + result = 31 * result + QueryPigeonUtils.deepHash(this.extras) + return result + } + override fun toString(): String { + return "ProviderCallRequest(authority=$authority, method=$method, arg=$arg, extras=$extras)" + } } /** @@ -690,112 +1227,131 @@ data class ProviderCallResponse ( result, ) } + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as ProviderCallResponse + return QueryPigeonUtils.deepEquals(this.result, other.result) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + QueryPigeonUtils.deepHash(this.result) + return result + } + override fun toString(): String { + return "ProviderCallResponse(result=$result)" + } } private open class QueryPigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { 129.toByte() -> { - return (readValue(buffer) as Long?)?.let { + (readValue(buffer) as Long?)?.let { ContentChangeType.ofRaw(it.toInt()) } } 130.toByte() -> { - return (readValue(buffer) as Long?)?.let { + (readValue(buffer) as Long?)?.let { BatchOperationType.ofRaw(it.toInt()) } } 131.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { QueryRequest.fromList(it) } } 132.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { QueryResponse.fromList(it) } } 133.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { InsertRequest.fromList(it) } } 134.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { BulkInsertRequest.fromList(it) } } 135.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { UpdateRequest.fromList(it) } } 136.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { DeleteRequest.fromList(it) } } 137.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { BatchOperation.fromList(it) } } 138.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { BatchRequest.fromList(it) } } 139.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { BatchOperationResult.fromList(it) } } 140.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { JoinSpec.fromList(it) } } 141.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { JoinQueryRequest.fromList(it) } } 142.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { JoinedRow.fromList(it) } } 143.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { JoinQueryResponse.fromList(it) } } 144.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { StreamDescriptor.fromList(it) } } 145.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { ContentChangeEvent.fromList(it) } } 146.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { ObserverRequest.fromList(it) } } 147.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { TypeResponse.fromList(it) } } 148.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { ProviderCallRequest.fromList(it) } } 149.toByte() -> { - return (readValue(buffer) as? List)?.let { + (readValue(buffer) as? List)?.let { ProviderCallResponse.fromList(it) } } @@ -806,11 +1362,11 @@ private open class QueryPigeonCodec : StandardMessageCodec() { when (value) { is ContentChangeType -> { stream.write(129) - writeValue(stream, value.raw) + writeValue(stream, value.raw.toLong()) } is BatchOperationType -> { stream.write(130) - writeValue(stream, value.raw) + writeValue(stream, value.raw.toLong()) } is QueryRequest -> { stream.write(131) @@ -967,10 +1523,10 @@ interface QueryHostApi { api.query(requestArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(QueryPigeonUtils.wrapResult(data)) } } } @@ -987,10 +1543,10 @@ interface QueryHostApi { api.queryWithJoins(requestArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(QueryPigeonUtils.wrapResult(data)) } } } @@ -1007,10 +1563,10 @@ interface QueryHostApi { api.insert(requestArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(QueryPigeonUtils.wrapResult(data)) } } } @@ -1027,10 +1583,10 @@ interface QueryHostApi { api.bulkInsert(requestArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(QueryPigeonUtils.wrapResult(data)) } } } @@ -1047,10 +1603,10 @@ interface QueryHostApi { api.update(requestArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(QueryPigeonUtils.wrapResult(data)) } } } @@ -1067,10 +1623,10 @@ interface QueryHostApi { api.delete(requestArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(QueryPigeonUtils.wrapResult(data)) } } } @@ -1087,10 +1643,10 @@ interface QueryHostApi { api.applyBatch(requestArg) { result: Result> -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(QueryPigeonUtils.wrapResult(data)) } } } @@ -1107,10 +1663,10 @@ interface QueryHostApi { api.openStream(contentUriArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(QueryPigeonUtils.wrapResult(data)) } } } @@ -1127,10 +1683,10 @@ interface QueryHostApi { api.extractToFile(contentUriArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(QueryPigeonUtils.wrapResult(data)) } } } @@ -1147,9 +1703,9 @@ interface QueryHostApi { api.closeStream(streamIdArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(QueryPigeonUtils.wrapResult(null)) } } } @@ -1166,10 +1722,10 @@ interface QueryHostApi { api.registerObserver(requestArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(QueryPigeonUtils.wrapResult(data)) } } } @@ -1186,9 +1742,9 @@ interface QueryHostApi { api.unregisterObserver(observerIdArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(QueryPigeonUtils.wrapResult(null)) } } } @@ -1203,9 +1759,9 @@ interface QueryHostApi { api.unregisterAllObservers{ result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { - reply.reply(wrapResult(null)) + reply.reply(QueryPigeonUtils.wrapResult(null)) } } } @@ -1222,10 +1778,10 @@ interface QueryHostApi { api.getType(contentUriArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(QueryPigeonUtils.wrapResult(data)) } } } @@ -1242,10 +1798,10 @@ interface QueryHostApi { api.canonicalize(contentUriArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(QueryPigeonUtils.wrapResult(data)) } } } @@ -1262,10 +1818,10 @@ interface QueryHostApi { api.uncanonicalize(contentUriArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(QueryPigeonUtils.wrapResult(data)) } } } @@ -1282,10 +1838,10 @@ interface QueryHostApi { api.call(requestArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(QueryPigeonUtils.wrapResult(data)) } } } @@ -1302,10 +1858,10 @@ interface QueryHostApi { api.hasPermission(permissionNameArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(QueryPigeonUtils.wrapResult(data)) } } } @@ -1320,10 +1876,10 @@ interface QueryHostApi { api.getAndroidSdkInt{ result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(QueryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(QueryPigeonUtils.wrapResult(data)) } } } @@ -1356,7 +1912,7 @@ class QueryFlutterApi(private val binaryMessenger: BinaryMessenger, private val callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(QueryPigeonUtils.createConnectionError(channelName))) } } } diff --git a/packages/simple_query_android/lib/src/generated/query.g.dart b/packages/simple_query_android/lib/src/generated/query.g.dart index d9cbea7..779b2f5 100644 --- a/packages/simple_query_android/lib/src/generated/query.g.dart +++ b/packages/simple_query_android/lib/src/generated/query.g.dart @@ -1,18 +1,37 @@ -// Autogenerated from Pigeon (v22.7.4), do not edit directly. +// Autogenerated from Pigeon (v30.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers +// ignore_for_file: unused_import, unused_shown_name +// ignore_for_file: type=lint import 'dart:async'; -import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; +import 'dart:typed_data' show Float64List, Int32List, Int64List; -import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; -PlatformException _createConnectionError(String channelName) { - return PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel: "$channelName".', - ); +Object? _extractReplyValueOrThrow( + List? replyList, + String channelName, { + required bool isNullValid, +}) { + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else if (!isNullValid && (replyList.isNotEmpty && replyList[0] == null)) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } + return replyList.firstOrNull; } List wrapResponse({ @@ -29,6 +48,69 @@ List wrapResponse({ return [error.code, error.message, error.details]; } +bool _deepEquals(Object? a, Object? b) { + if (identical(a, b)) { + return true; + } + if (a is double && b is double) { + if (a.isNaN && b.isNaN) { + return true; + } + return a == b; + } + if (a is List && b is List) { + return a.length == b.length && + a.indexed.every( + ((int, dynamic) item) => _deepEquals(item.$2, b[item.$1]), + ); + } + if (a is Map && b is Map) { + if (a.length != b.length) { + return false; + } + for (final MapEntry entryA in a.entries) { + bool found = false; + for (final MapEntry entryB in b.entries) { + if (_deepEquals(entryA.key, entryB.key)) { + if (_deepEquals(entryA.value, entryB.value)) { + found = true; + break; + } else { + return false; + } + } + } + if (!found) { + return false; + } + } + return true; + } + return a == b; +} + +int _deepHash(Object? value) { + if (value is List) { + return Object.hashAll(value.map(_deepHash)); + } + if (value is Map) { + int result = 0; + for (final MapEntry entry in value.entries) { + result += (_deepHash(entry.key) * 31) ^ _deepHash(entry.value); + } + return result; + } + if (value is double && value.isNaN) { + // Normalize NaN to a consistent hash. + return 0x7FF8000000000000.hashCode; + } + if (value is double && value == 0.0) { + // Normalize -0.0 to 0.0 so they have the same hash code. + return 0.0.hashCode; + } + return value.hashCode; +} + /// Type of content change observed by ContentObserver. enum ContentChangeType { insert, update, delete, unknown } @@ -68,7 +150,7 @@ class QueryRequest { /// Number of rows to skip (for pagination). int? offset; - Object encode() { + List _toList() { return [ contentUri, projection, @@ -80,6 +162,10 @@ class QueryRequest { ]; } + Object encode() { + return _toList(); + } + static QueryRequest decode(Object result) { result as List; return QueryRequest( @@ -92,6 +178,33 @@ class QueryRequest { offset: result[6] as int?, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! QueryRequest || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(contentUri, other.contentUri) && + _deepEquals(projection, other.projection) && + _deepEquals(selection, other.selection) && + _deepEquals(selectionArgs, other.selectionArgs) && + _deepEquals(sortOrder, other.sortOrder) && + _deepEquals(limit, other.limit) && + _deepEquals(offset, other.offset); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'QueryRequest(contentUri: $contentUri, projection: $projection, selection: $selection, selectionArgs: $selectionArgs, sortOrder: $sortOrder, limit: $limit, offset: $offset)'; + } } /// Response from a query operation. @@ -110,18 +223,45 @@ class QueryResponse { /// Column names in result set. List? columnNames; - Object encode() { + List _toList() { return [rows, rowCount, columnNames]; } + Object encode() { + return _toList(); + } + static QueryResponse decode(Object result) { result as List; return QueryResponse( - rows: (result[0] as List?)!.cast(), + rows: result[0]! as List, rowCount: result[1]! as int, columnNames: (result[2] as List?)?.cast(), ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! QueryResponse || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(rows, other.rows) && + _deepEquals(rowCount, other.rowCount) && + _deepEquals(columnNames, other.columnNames); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'QueryResponse(rows: $rows, rowCount: $rowCount, columnNames: $columnNames)'; + } } /// Request to insert a row. @@ -133,17 +273,43 @@ class InsertRequest { /// Column name to value map. Map values; - Object encode() { + List _toList() { return [contentUri, values]; } + Object encode() { + return _toList(); + } + static InsertRequest decode(Object result) { result as List; return InsertRequest( contentUri: result[0]! as String, - values: (result[1] as Map?)!.cast(), + values: (result[1]! as Map).cast(), ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! InsertRequest || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(contentUri, other.contentUri) && + _deepEquals(values, other.values); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'InsertRequest(contentUri: $contentUri, values: $values)'; + } } /// Request to insert multiple rows. @@ -155,17 +321,43 @@ class BulkInsertRequest { /// List of rows to insert. List?> valuesList; - Object encode() { + List _toList() { return [contentUri, valuesList]; } + Object encode() { + return _toList(); + } + static BulkInsertRequest decode(Object result) { result as List; return BulkInsertRequest( contentUri: result[0]! as String, - valuesList: (result[1] as List?)!.cast?>(), + valuesList: (result[1]! as List).cast?>(), ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! BulkInsertRequest || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(contentUri, other.contentUri) && + _deepEquals(valuesList, other.valuesList); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'BulkInsertRequest(contentUri: $contentUri, valuesList: $valuesList)'; + } } /// Request to update rows. @@ -188,19 +380,47 @@ class UpdateRequest { /// Values for ? placeholders. List? selectionArgs; - Object encode() { + List _toList() { return [contentUri, values, selection, selectionArgs]; } + Object encode() { + return _toList(); + } + static UpdateRequest decode(Object result) { result as List; return UpdateRequest( contentUri: result[0]! as String, - values: (result[1] as Map?)!.cast(), + values: (result[1]! as Map).cast(), selection: result[2] as String?, selectionArgs: (result[3] as List?)?.cast(), ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! UpdateRequest || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(contentUri, other.contentUri) && + _deepEquals(values, other.values) && + _deepEquals(selection, other.selection) && + _deepEquals(selectionArgs, other.selectionArgs); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'UpdateRequest(contentUri: $contentUri, values: $values, selection: $selection, selectionArgs: $selectionArgs)'; + } } /// Request to delete rows. @@ -215,10 +435,14 @@ class DeleteRequest { /// Values for ? placeholders. List? selectionArgs; - Object encode() { + List _toList() { return [contentUri, selection, selectionArgs]; } + Object encode() { + return _toList(); + } + static DeleteRequest decode(Object result) { result as List; return DeleteRequest( @@ -227,6 +451,29 @@ class DeleteRequest { selectionArgs: (result[2] as List?)?.cast(), ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! DeleteRequest || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(contentUri, other.contentUri) && + _deepEquals(selection, other.selection) && + _deepEquals(selectionArgs, other.selectionArgs); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'DeleteRequest(contentUri: $contentUri, selection: $selection, selectionArgs: $selectionArgs)'; + } } /// Single operation in a batch. @@ -263,7 +510,7 @@ class BatchOperation { /// Column to use from back-referenced result. String? backReferenceColumn; - Object encode() { + List _toList() { return [ type, contentUri, @@ -276,6 +523,10 @@ class BatchOperation { ]; } + Object encode() { + return _toList(); + } + static BatchOperation decode(Object result) { result as List; return BatchOperation( @@ -289,6 +540,34 @@ class BatchOperation { backReferenceColumn: result[7] as String?, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! BatchOperation || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(type, other.type) && + _deepEquals(contentUri, other.contentUri) && + _deepEquals(values, other.values) && + _deepEquals(selection, other.selection) && + _deepEquals(selectionArgs, other.selectionArgs) && + _deepEquals(expectedCount, other.expectedCount) && + _deepEquals(backReferenceIndex, other.backReferenceIndex) && + _deepEquals(backReferenceColumn, other.backReferenceColumn); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'BatchOperation(type: $type, contentUri: $contentUri, values: $values, selection: $selection, selectionArgs: $selectionArgs, expectedCount: $expectedCount, backReferenceIndex: $backReferenceIndex, backReferenceColumn: $backReferenceColumn)'; + } } /// Request for batch operations. @@ -301,17 +580,43 @@ class BatchRequest { /// List of operations to apply atomically. List operations; - Object encode() { + List _toList() { return [authority, operations]; } + Object encode() { + return _toList(); + } + static BatchRequest decode(Object result) { result as List; return BatchRequest( authority: result[0]! as String, - operations: (result[1] as List?)!.cast(), + operations: (result[1]! as List).cast(), ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! BatchRequest || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(authority, other.authority) && + _deepEquals(operations, other.operations); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'BatchRequest(authority: $authority, operations: $operations)'; + } } /// Result of a single batch operation. @@ -324,10 +629,14 @@ class BatchOperationResult { /// Number of affected rows (for update/delete). int? count; - Object encode() { + List _toList() { return [uri, count]; } + Object encode() { + return _toList(); + } + static BatchOperationResult decode(Object result) { result as List; return BatchOperationResult( @@ -335,6 +644,27 @@ class BatchOperationResult { count: result[1] as int?, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! BatchOperationResult || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(uri, other.uri) && _deepEquals(count, other.count); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'BatchOperationResult(uri: $uri, count: $count)'; + } } /// Specification for a joined/related query. @@ -372,7 +702,7 @@ class JoinSpec { String? sortOrder; - Object encode() { + List _toList() { return [ name, contentUri, @@ -385,6 +715,10 @@ class JoinSpec { ]; } + Object encode() { + return _toList(); + } + static JoinSpec decode(Object result) { result as List; return JoinSpec( @@ -398,6 +732,34 @@ class JoinSpec { sortOrder: result[7] as String?, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! JoinSpec || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(name, other.name) && + _deepEquals(contentUri, other.contentUri) && + _deepEquals(foreignKeyColumn, other.foreignKeyColumn) && + _deepEquals(parentKeyColumn, other.parentKeyColumn) && + _deepEquals(projection, other.projection) && + _deepEquals(selection, other.selection) && + _deepEquals(selectionArgs, other.selectionArgs) && + _deepEquals(sortOrder, other.sortOrder); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'JoinSpec(name: $name, contentUri: $contentUri, foreignKeyColumn: $foreignKeyColumn, parentKeyColumn: $parentKeyColumn, projection: $projection, selection: $selection, selectionArgs: $selectionArgs, sortOrder: $sortOrder)'; + } } /// Request for a query with joins. @@ -410,17 +772,43 @@ class JoinQueryRequest { /// Related queries to join. List joins; - Object encode() { + List _toList() { return [primary, joins]; } + Object encode() { + return _toList(); + } + static JoinQueryRequest decode(Object result) { result as List; return JoinQueryRequest( primary: result[0]! as QueryRequest, - joins: (result[1] as List?)!.cast(), + joins: (result[1]! as List).cast(), ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! JoinQueryRequest || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(primary, other.primary) && + _deepEquals(joins, other.joins); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'JoinQueryRequest(primary: $primary, joins: $joins)'; + } } /// A row with nested related data. @@ -435,14 +823,39 @@ class JoinedRow { /// Note: Uses Object to avoid Pigeon CastList issues with nested generics. Object related; - Object encode() { + List _toList() { return [data, related]; } + Object encode() { + return _toList(); + } + static JoinedRow decode(Object result) { result as List; return JoinedRow(data: result[0]!, related: result[1]!); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! JoinedRow || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(data, other.data) && _deepEquals(related, other.related); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'JoinedRow(data: $data, related: $related)'; + } } /// Response for a join query. @@ -453,17 +866,43 @@ class JoinQueryResponse { int rowCount; - Object encode() { + List _toList() { return [rows, rowCount]; } + Object encode() { + return _toList(); + } + static JoinQueryResponse decode(Object result) { result as List; return JoinQueryResponse( - rows: (result[0] as List?)!.cast(), + rows: (result[0]! as List).cast(), rowCount: result[1]! as int, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! JoinQueryResponse || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(rows, other.rows) && + _deepEquals(rowCount, other.rowCount); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'JoinQueryResponse(rows: $rows, rowCount: $rowCount)'; + } } /// Descriptor for an open stream. @@ -487,10 +926,14 @@ class StreamDescriptor { /// Size in bytes if known. int? size; - Object encode() { + List _toList() { return [streamId, pipePath, mimeType, size]; } + Object encode() { + return _toList(); + } + static StreamDescriptor decode(Object result) { result as List; return StreamDescriptor( @@ -500,6 +943,30 @@ class StreamDescriptor { size: result[3] as int?, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! StreamDescriptor || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(streamId, other.streamId) && + _deepEquals(pipePath, other.pipePath) && + _deepEquals(mimeType, other.mimeType) && + _deepEquals(size, other.size); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'StreamDescriptor(streamId: $streamId, pipePath: $pipePath, mimeType: $mimeType, size: $size)'; + } } /// Event from ContentObserver. @@ -529,10 +996,14 @@ class ContentChangeEvent { /// the current app. Consumers must reconcile regardless of this value. bool selfChange; - Object encode() { + List _toList() { return [observerId, uri, changeType, flags, selfChange]; } + Object encode() { + return _toList(); + } + static ContentChangeEvent decode(Object result) { result as List; return ContentChangeEvent( @@ -543,6 +1014,31 @@ class ContentChangeEvent { selfChange: result[4]! as bool, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! ContentChangeEvent || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(observerId, other.observerId) && + _deepEquals(uri, other.uri) && + _deepEquals(changeType, other.changeType) && + _deepEquals(flags, other.flags) && + _deepEquals(selfChange, other.selfChange); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'ContentChangeEvent(observerId: $observerId, uri: $uri, changeType: $changeType, flags: $flags, selfChange: $selfChange)'; + } } /// Request to register an observer. @@ -554,10 +1050,14 @@ class ObserverRequest { /// If true, also notify for changes to descendant URIs. bool notifyForDescendants; - Object encode() { + List _toList() { return [contentUri, notifyForDescendants]; } + Object encode() { + return _toList(); + } + static ObserverRequest decode(Object result) { result as List; return ObserverRequest( @@ -565,6 +1065,28 @@ class ObserverRequest { notifyForDescendants: result[1]! as bool, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! ObserverRequest || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(contentUri, other.contentUri) && + _deepEquals(notifyForDescendants, other.notifyForDescendants); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'ObserverRequest(contentUri: $contentUri, notifyForDescendants: $notifyForDescendants)'; + } } /// Response for getType(). @@ -574,14 +1096,39 @@ class TypeResponse { /// MIME type (e.g., "vnd.android.cursor.dir/sms"). String? mimeType; - Object encode() { + List _toList() { return [mimeType]; } + Object encode() { + return _toList(); + } + static TypeResponse decode(Object result) { result as List; return TypeResponse(mimeType: result[0] as String?); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! TypeResponse || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(mimeType, other.mimeType); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'TypeResponse(mimeType: $mimeType)'; + } } /// Request for provider call(). @@ -601,10 +1148,14 @@ class ProviderCallRequest { Map? extras; - Object encode() { + List _toList() { return [authority, method, arg, extras]; } + Object encode() { + return _toList(); + } + static ProviderCallRequest decode(Object result) { result as List; return ProviderCallRequest( @@ -614,6 +1165,30 @@ class ProviderCallRequest { extras: (result[3] as Map?)?.cast(), ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! ProviderCallRequest || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(authority, other.authority) && + _deepEquals(method, other.method) && + _deepEquals(arg, other.arg) && + _deepEquals(extras, other.extras); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'ProviderCallRequest(authority: $authority, method: $method, arg: $arg, extras: $extras)'; + } } /// Response from provider call(). @@ -622,16 +1197,41 @@ class ProviderCallResponse { Map? result; - Object encode() { + List _toList() { return [result]; } + Object encode() { + return _toList(); + } + static ProviderCallResponse decode(Object result) { result as List; return ProviderCallResponse( result: (result[0] as Map?)?.cast(), ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! ProviderCallResponse || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(result, other.result); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'ProviderCallResponse(result: $result)'; + } } class _PigeonCodec extends StandardMessageCodec { @@ -713,10 +1313,10 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : ContentChangeType.values[value]; case 130: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : BatchOperationType.values[value]; case 131: return QueryRequest.decode(readValue(buffer)!); @@ -763,8 +1363,8 @@ class _PigeonCodec extends StandardMessageCodec { } class QueryHostApi { - /// Constructor for [QueryHostApi]. The [binaryMessenger] named argument is - /// available for dependency injection. If it is left null, the default + /// Constructor for [QueryHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. QueryHostApi({ BinaryMessenger? binaryMessenger, @@ -773,486 +1373,363 @@ class QueryHostApi { pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? pigeonVar_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); final String pigeonVar_messageChannelSuffix; Future query(QueryRequest request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.query$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as QueryResponse?)!; - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as QueryResponse; } Future queryWithJoins(JoinQueryRequest request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.queryWithJoins$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as JoinQueryResponse?)!; - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as JoinQueryResponse; } /// Insert a row. Returns URI of inserted row. Future insert(InsertRequest request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.insert$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as String?); - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as String?; } /// Insert multiple rows. Returns count of inserted rows. Future bulkInsert(BulkInsertRequest request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.bulkInsert$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as int?)!; - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as int; } /// Update rows. Returns count of updated rows. Future update(UpdateRequest request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.update$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as int?)!; - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as int; } /// Delete rows. Returns count of deleted rows. Future delete(DeleteRequest request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.delete$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as int?)!; - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as int; } /// Apply batch operations atomically. Future> applyBatch(BatchRequest request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.applyBatch$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as List?)! - .cast(); - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as List) + .cast(); } /// Open a stream for reading binary content. /// Returns StreamDescriptor with pipe path for zero-copy reading. Future openStream(String contentUri) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.openStream$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([contentUri]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as StreamDescriptor?)!; - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [contentUri], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as StreamDescriptor; } /// Extract content to a temp file. /// Returns file:// URI to the temp file. Future extractToFile(String contentUri) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.extractToFile$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([contentUri]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as String?); - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [contentUri], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as String?; } /// Close an open stream and release resources. Future closeStream(String streamId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.closeStream$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([streamId]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [streamId], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Register a ContentObserver. Returns observer ID. Future registerObserver(ObserverRequest request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.registerObserver$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as String; } /// Unregister a ContentObserver. Future unregisterObserver(String observerId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.unregisterObserver$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([observerId]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [observerId], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Unregister all observers. Future unregisterAllObservers() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.unregisterAllObservers$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send(null) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Get MIME type for a content URI. Future getType(String contentUri) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.getType$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([contentUri]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as TypeResponse?)!; - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [contentUri], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as TypeResponse; } /// Canonicalize a URI for cross-device portability. Future canonicalize(String contentUri) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.canonicalize$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([contentUri]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as String?); - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [contentUri], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as String?; } /// Reverse canonicalization. Future uncanonicalize(String contentUri) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.uncanonicalize$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([contentUri]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as String?); - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [contentUri], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as String?; } /// Call a provider-defined method. Future call(ProviderCallRequest request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.call$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as ProviderCallResponse?)!; - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as ProviderCallResponse; } /// Returns true if the calling app holds [permissionName] @@ -1261,65 +1738,44 @@ class QueryHostApi { /// `Context.checkSelfPermission`. Synchronous on the native side; pigeon /// makes it async on the Dart side. Future hasPermission(String permissionName) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.hasPermission$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([permissionName]) - as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [permissionName], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } /// Returns the device's `Build.VERSION.SDK_INT`. Used by the Dart-side /// permission catalog to pick between legacy and modern media permissions /// (`READ_EXTERNAL_STORAGE` vs `READ_MEDIA_*`). Future getAndroidSdkInt() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query.QueryHostApi.getAndroidSdkInt$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send(null) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as int?)!; - } + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as int; } } @@ -1327,7 +1783,7 @@ abstract class QueryFlutterApi { static const MessageCodec pigeonChannelCodec = _PigeonCodec(); /// Called when observed content changes. - void onContentChange(ContentChangeEvent event); + Future onContentChange(ContentChangeEvent event); static void setUp( QueryFlutterApi? api, { @@ -1338,8 +1794,7 @@ abstract class QueryFlutterApi { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.simple_query.QueryFlutterApi.onContentChange$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -1348,19 +1803,10 @@ abstract class QueryFlutterApi { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.simple_query.QueryFlutterApi.onContentChange was null.', - ); - final List args = (message as List?)!; - final ContentChangeEvent? arg_event = - (args[0] as ContentChangeEvent?); - assert( - arg_event != null, - 'Argument for dev.flutter.pigeon.simple_query.QueryFlutterApi.onContentChange was null, expected non-null ContentChangeEvent.', - ); + final List args = message! as List; + final ContentChangeEvent arg_event = args[0]! as ContentChangeEvent; try { - api.onContentChange(arg_event!); + await api.onContentChange(arg_event); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); diff --git a/packages/simple_query_android/lib/src/host_errors.dart b/packages/simple_query_android/lib/src/host_errors.dart index a6c2bd9..7c854b5 100644 --- a/packages/simple_query_android/lib/src/host_errors.dart +++ b/packages/simple_query_android/lib/src/host_errors.dart @@ -85,7 +85,7 @@ iface.SimpleQueryError mapHostError( domain: domain, operation: operation, details: { - if (failingUri != null) 'contentUri': failingUri, + 'contentUri': ?failingUri, 'code': error.code, if (nativeType is String) 'nativeType': nativeType, 'details': nativeDetails, diff --git a/packages/simple_query_android/lib/src/simple_query_android_api.dart b/packages/simple_query_android/lib/src/simple_query_android_api.dart index d59bb27..6434a67 100644 --- a/packages/simple_query_android/lib/src/simple_query_android_api.dart +++ b/packages/simple_query_android/lib/src/simple_query_android_api.dart @@ -542,7 +542,7 @@ class SimpleQueryAndroidApi implements p.QueryFlutterApi { } @override - void onContentChange(p.ContentChangeEvent event) { + Future onContentChange(p.ContentChangeEvent event) async { final registration = _activeObservers[event.observerId]; if (registration == null) return; diff --git a/packages/simple_query_android/pigeon.dart b/packages/simple_query_android/pigeon.dart index 8e2c647..0405a35 100644 --- a/packages/simple_query_android/pigeon.dart +++ b/packages/simple_query_android/pigeon.dart @@ -426,82 +426,82 @@ class ProviderCallResponse { abstract class QueryHostApi { // --- Query Operations --- - @async + @asyncCallback QueryResponse query(QueryRequest request); - @async + @asyncCallback JoinQueryResponse queryWithJoins(JoinQueryRequest request); // --- Write Operations --- /// Insert a row. Returns URI of inserted row. - @async + @asyncCallback String? insert(InsertRequest request); /// Insert multiple rows. Returns count of inserted rows. - @async + @asyncCallback int bulkInsert(BulkInsertRequest request); /// Update rows. Returns count of updated rows. - @async + @asyncCallback int update(UpdateRequest request); /// Delete rows. Returns count of deleted rows. - @async + @asyncCallback int delete(DeleteRequest request); // --- Batch Operations --- /// Apply batch operations atomically. - @async + @asyncCallback List applyBatch(BatchRequest request); // --- Streaming --- /// Open a stream for reading binary content. /// Returns StreamDescriptor with pipe path for zero-copy reading. - @async + @asyncCallback StreamDescriptor openStream(String contentUri); /// Extract content to a temp file. /// Returns file:// URI to the temp file. - @async + @asyncCallback String? extractToFile(String contentUri); /// Close an open stream and release resources. - @async + @asyncCallback void closeStream(String streamId); // --- Observers --- /// Register a ContentObserver. Returns observer ID. - @async + @asyncCallback String registerObserver(ObserverRequest request); /// Unregister a ContentObserver. - @async + @asyncCallback void unregisterObserver(String observerId); /// Unregister all observers. - @async + @asyncCallback void unregisterAllObservers(); // --- Metadata --- /// Get MIME type for a content URI. - @async + @asyncCallback TypeResponse getType(String contentUri); /// Canonicalize a URI for cross-device portability. - @async + @asyncCallback String? canonicalize(String contentUri); /// Reverse canonicalization. - @async + @asyncCallback String? uncanonicalize(String contentUri); /// Call a provider-defined method. - @async + @asyncCallback ProviderCallResponse call(ProviderCallRequest request); // --- Permissions --- @@ -511,13 +511,13 @@ abstract class QueryHostApi { /// `android.permission.READ_CONTACTS`). Implemented via /// `Context.checkSelfPermission`. Synchronous on the native side; pigeon /// makes it async on the Dart side. - @async + @asyncCallback bool hasPermission(String permissionName); /// Returns the device's `Build.VERSION.SDK_INT`. Used by the Dart-side /// permission catalog to pick between legacy and modern media permissions /// (`READ_EXTERNAL_STORAGE` vs `READ_MEDIA_*`). - @async + @asyncCallback int getAndroidSdkInt(); } @@ -528,5 +528,6 @@ abstract class QueryHostApi { @FlutterApi() abstract class QueryFlutterApi { /// Called when observed content changes. + @asyncCallback void onContentChange(ContentChangeEvent event); } diff --git a/packages/simple_query_android/pubspec.lock b/packages/simple_query_android/pubspec.lock new file mode 100644 index 0000000..25c6a03 --- /dev/null +++ b/packages/simple_query_android/pubspec.lock @@ -0,0 +1,380 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "1c5591cc6f252d5f440d96ab87c03e43504be552a3fa49d7cb7563f04c51fb0a" + url: "https://pub.dev" + source: hosted + version: "111.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "6c39bd5486a310e56217bed7cb1691377959f31be4227e41750107db7e6dd55c" + url: "https://pub.dev" + source: hosted + version: "14.7.0" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "44922ecebd8e3d0cef743dadd3b54df4e87e2a4c52a29465a1872aa9e192caa8" + url: "https://pub.dev" + source: hosted + version: "5.1.2" + built_value: + dependency: transitive + description: + name: built_value + sha256: f87ea98192116f7093cb214551ce1929caae0681fdba282b3d8b4462adee7bb7 + url: "https://pub.dev" + source: hosted + version: "8.13.0" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + clock: + dependency: transitive + description: + name: clock + sha256: e51d50bca3217c9a9fa2b41a30e4a38971133f5f9ec7a3d57bae095007f1d28e + url: "https://pub.dev" + source: hosted + version: "1.1.3" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "811709c1badd02fc054039a13f66e0db1961865f9a314175f68c3eaeebec786f" + url: "https://pub.dev" + source: hosted + version: "4.13.0" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + crypto: + dependency: transitive + description: + name: crypto + sha256: e3626ae6270383c9e3a549f34c9e4cd26c09ae6a9adaab2bf4737a00340efdc4 + url: "https://pub.dev" + source: hosted + version: "3.0.8" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: a0e4f65339b31eb6a9e6a12e14b4682a48d46fbc54a82f4a702396fbdbac63a7 + url: "https://pub.dev" + source: hosted + version: "3.1.14" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: "218aeb56050c714f62a3182775320dfa04602b55074873e24e31bbd39bda96fb" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + listen: + dependency: transitive + description: + name: listen + sha256: "47501a08016a43fcad79252439d723f50f14f88fa7bfd8a177e0a417e5c9e1f2" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd" + url: "https://pub.dev" + source: hosted + version: "0.12.20" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + meta: + dependency: "direct main" + description: + name: meta + sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" + url: "https://pub.dev" + source: hosted + version: "1.19.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: ffcf4cf3d6c0b74ac43708d9f56625506e8a68aa935abe9d267a7330f320eb5d + url: "https://pub.dev" + source: hosted + version: "3.0.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + pigeon: + dependency: "direct dev" + description: + name: pigeon + sha256: "5c2ac8dd19571590eaf4c178bf4a093b5646dc376d2d2619943ce2aa0aa860d0" + url: "https://pub.dev" + source: hosted + version: "30.0.4" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "261236774e8b1d69cfc6b9eabbc96c40f25e7a2d6b171f3385d4f65d5734fb24" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + simple_query_platform_interface: + dependency: "direct main" + description: + path: "../simple_query_platform_interface" + relative: true + source: path + version: "0.2.2" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490" + url: "https://pub.dev" + source: hosted + version: "1.12.2" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "0a10344e901e5b2e63819567951cb6a06673ed6b84f40462188ff5a0c41f371f" + url: "https://pub.dev" + source: hosted + version: "0.7.14" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: fa49e1674cb84acb900141714e6c6e1f9ae099827c24d141430ff6819db4e1bc + url: "https://pub.dev" + source: hosted + version: "2.4.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "89b11d62e1040ee681af3b4f1c97a803ecbf010c6e8b9c5896ee5b08c3bf7b78" + url: "https://pub.dev" + source: hosted + version: "15.4.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: f67cdd8e07d3c6329146aaef1ba043542b3134c12489f553ca9a7435d1068aea + url: "https://pub.dev" + source: hosted + version: "3.1.4" +sdks: + dart: ">=3.13.0 <4.0.0" + flutter: ">=3.47.7" diff --git a/packages/simple_query_android/pubspec.yaml b/packages/simple_query_android/pubspec.yaml index 920d941..b344c7d 100644 --- a/packages/simple_query_android/pubspec.yaml +++ b/packages/simple_query_android/pubspec.yaml @@ -13,19 +13,20 @@ topics: - files environment: - sdk: ^3.12.0 - flutter: '>=3.44.0' + sdk: ^3.13.0 + flutter: '>=3.47.7' dependencies: flutter: sdk: flutter + meta: ^1.17.0 simple_query_platform_interface: ^0.2.1 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^5.0.0 - pigeon: 22.7.4 + flutter_lints: 6.0.0 + pigeon: 30.0.4 flutter: plugin: diff --git a/packages/simple_query_android/test/simple_query_android_api_test.dart b/packages/simple_query_android/test/simple_query_android_api_test.dart index f89813c..ab26f70 100644 --- a/packages/simple_query_android/test/simple_query_android_api_test.dart +++ b/packages/simple_query_android/test/simple_query_android_api_test.dart @@ -576,7 +576,7 @@ void main() { details: { 'reason': 'nullCursor', 'contentUri': contentUri, - if (join != null) 'join': join, + 'join': ?join, }, ); @@ -2164,7 +2164,7 @@ void main() { .listen(events.add); addTearDown(subscription.cancel); await Future.delayed(Duration.zero); - api.onContentChange(p.ContentChangeEvent( + await api.onContentChange(p.ContentChangeEvent( observerId: 'obs_1', uri: uri, changeType: changeType, @@ -2234,7 +2234,7 @@ void main() { .listen(events.add); addTearDown(subscription.cancel); await Future.delayed(Duration.zero); - api.onContentChange(p.ContentChangeEvent( + await api.onContentChange(p.ContentChangeEvent( observerId: 'no-such-observer', uri: 'content://sms/1', changeType: p.ContentChangeType.insert, diff --git a/packages/simple_query_ios/CHANGELOG.md b/packages/simple_query_ios/CHANGELOG.md index 3338472..31c417a 100644 --- a/packages/simple_query_ios/CHANGELOG.md +++ b/packages/simple_query_ios/CHANGELOG.md @@ -1,3 +1,8 @@ +## Unreleased + +- **Breaking:** Requires Flutter 3.47.7 / Dart 3.13. Release as a breaking version (the next 0.x minor) (UNFY-412). +- Regenerates the platform channel code with Pigeon 30 (UNFY-412). + ## 0.3.0 - chore(release): reset versions to align with pub.dev (smallest iteration) diff --git a/packages/simple_query_ios/ios/simple_query_ios/Sources/simple_query_ios/NativeQuery.g.swift b/packages/simple_query_ios/ios/simple_query_ios/Sources/simple_query_ios/NativeQuery.g.swift index 22b01e2..9e0b4a2 100644 --- a/packages/simple_query_ios/ios/simple_query_ios/Sources/simple_query_ios/NativeQuery.g.swift +++ b/packages/simple_query_ios/ios/simple_query_ios/Sources/simple_query_ios/NativeQuery.g.swift @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v22.7.4), do not edit directly. +// Autogenerated from Pigeon (v30.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -15,9 +15,9 @@ import Foundation final class NativeQueryPigeonError: Error { let code: String let message: String? - let details: Any? + let details: Sendable? - init(code: String, message: String?, details: Any?) { + init(code: String, message: String?, details: Sendable?) { self.code = code self.message = message self.details = details @@ -25,8 +25,8 @@ final class NativeQueryPigeonError: Error { var localizedDescription: String { return - "NativeQueryPigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" - } + "NativeQueryPigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? ""))" + } } private func wrapResult(_ result: Any?) -> [Any?] { @@ -50,7 +50,7 @@ private func wrapError(_ error: Any) -> [Any?] { } return [ "\(error)", - "\(type(of: error))", + "\(Swift.type(of: error))", "Stacktrace: \(Thread.callStackSymbols)", ] } @@ -59,8 +59,18 @@ private func createConnectionError(withChannelName channelName: String) -> Nativ return NativeQueryPigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") } -private func isNullish(_ value: Any?) -> Bool { - return value is NSNull || value == nil +enum NativeQueryPigeonInternal { + static func isNullish(_ value: Any?) -> Bool { + guard let innerValue = value else { + return true + } + + if case Optional.some(Optional.none) = value { + return true + } + + return innerValue is NSNull + } } private func nilOrValue(_ value: Any?) -> T? { @@ -68,6 +78,7 @@ private func nilOrValue(_ value: Any?) -> T? { return value as! T? } + private class NativeQueryPigeonCodecReader: FlutterStandardReader { } @@ -244,6 +255,7 @@ class NativeQueryHostApiSetup { } } } + /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol NativeQueryFlutterApiProtocol { func onObserveEvent(observerId observerIdArg: String, event eventArg: [String?: Any?], completion: @escaping (Result) -> Void) @@ -272,7 +284,7 @@ class NativeQueryFlutterApi: NativeQueryFlutterApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(NativeQueryPigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } diff --git a/packages/simple_query_ios/lib/simple_query_ios.dart b/packages/simple_query_ios/lib/simple_query_ios.dart index 4c04623..3f05b6a 100644 --- a/packages/simple_query_ios/lib/simple_query_ios.dart +++ b/packages/simple_query_ios/lib/simple_query_ios.dart @@ -38,7 +38,10 @@ class SimpleQueryIos extends DarwinQueryPlatform } @override - void onObserveEvent(String observerId, Map event) { + Future onObserveEvent( + String observerId, + Map event, + ) async { onObserveEventFromNative(observerId, event); } diff --git a/packages/simple_query_ios/lib/src/generated/native_query.g.dart b/packages/simple_query_ios/lib/src/generated/native_query.g.dart index 7edd95a..8160f36 100644 --- a/packages/simple_query_ios/lib/src/generated/native_query.g.dart +++ b/packages/simple_query_ios/lib/src/generated/native_query.g.dart @@ -1,22 +1,44 @@ -// Autogenerated from Pigeon (v22.7.4), do not edit directly. +// Autogenerated from Pigeon (v30.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers +// ignore_for_file: unused_import, unused_shown_name +// ignore_for_file: type=lint import 'dart:async'; -import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; +import 'dart:typed_data' show Float64List, Int32List, Int64List; -import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; -PlatformException _createConnectionError(String channelName) { - return PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel: "$channelName".', - ); +Object? _extractReplyValueOrThrow( + List? replyList, + String channelName, { + required bool isNullValid, +}) { + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else if (!isNullValid && (replyList.isNotEmpty && replyList[0] == null)) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } + return replyList.firstOrNull; } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({ + Object? result, + PlatformException? error, + bool empty = false, +}) { if (empty) { return []; } @@ -48,316 +70,247 @@ class _PigeonCodec extends StandardMessageCodec { } class NativeQueryHostApi { - /// Constructor for [NativeQueryHostApi]. The [binaryMessenger] named argument is - /// available for dependency injection. If it is left null, the default + /// Constructor for [NativeQueryHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - NativeQueryHostApi( - {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? pigeonVar_binaryMessenger; + NativeQueryHostApi({ + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); final String pigeonVar_messageChannelSuffix; Future> getCapabilities() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_ios.NativeQueryHostApi.getCapabilities$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send(null) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } Future> query(Map request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_ios.NativeQueryHostApi.query$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } Future> mutate(Map request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_ios.NativeQueryHostApi.mutate$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } Future> batch(Map request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_ios.NativeQueryHostApi.batch$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } Future observeStart(Map request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_ios.NativeQueryHostApi.observeStart$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as String; } Future observeStop(String observerId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_ios.NativeQueryHostApi.observeStop$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([observerId]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [observerId], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } Future> openBinary( - Map request) async { - final String pigeonVar_channelName = + Map request, + ) async { + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_ios.NativeQueryHostApi.openBinary$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } Future closeBinary(String handleId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_ios.NativeQueryHostApi.closeBinary$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([handleId]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [handleId], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } Future?> callExtension( - String namespace, String method, Map? args) async { - final String pigeonVar_channelName = + String namespace, + String method, + Map? args, + ) async { + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_ios.NativeQueryHostApi.callExtension$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([namespace, method, args]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as Map?) - ?.cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [namespace, method, args], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return (pigeonVar_replyValue as Map?) + ?.cast(); } } abstract class NativeQueryFlutterApi { static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - void onObserveEvent(String observerId, Map event); + Future onObserveEvent(String observerId, Map event); static void setUp( NativeQueryFlutterApi? api, { BinaryMessenger? binaryMessenger, String messageChannelSuffix = '', }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.simple_query_ios.NativeQueryFlutterApi.onObserveEvent$messageChannelSuffix', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); + final pigeonVar_channel = BasicMessageChannel( + 'dev.flutter.pigeon.simple_query_ios.NativeQueryFlutterApi.onObserveEvent$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger, + ); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.simple_query_ios.NativeQueryFlutterApi.onObserveEvent was null.'); - final List args = (message as List?)!; - final String? arg_observerId = (args[0] as String?); - assert(arg_observerId != null, - 'Argument for dev.flutter.pigeon.simple_query_ios.NativeQueryFlutterApi.onObserveEvent was null, expected non-null String.'); - final Map? arg_event = - (args[1] as Map?)?.cast(); - assert(arg_event != null, - 'Argument for dev.flutter.pigeon.simple_query_ios.NativeQueryFlutterApi.onObserveEvent was null, expected non-null Map.'); + final List args = message! as List; + final String arg_observerId = args[0]! as String; + final Map arg_event = + (args[1]! as Map).cast(); try { - api.onObserveEvent(arg_observerId!, arg_event!); + await api.onObserveEvent(arg_observerId, arg_event); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); } catch (e) { return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + error: PlatformException(code: 'error', message: e.toString()), + ); } }); } diff --git a/packages/simple_query_ios/pigeon.dart b/packages/simple_query_ios/pigeon.dart index a554184..aa53518 100644 --- a/packages/simple_query_ios/pigeon.dart +++ b/packages/simple_query_ios/pigeon.dart @@ -29,5 +29,6 @@ abstract class NativeQueryHostApi { @FlutterApi() abstract class NativeQueryFlutterApi { + @asyncCallback void onObserveEvent(String observerId, Map event); } diff --git a/packages/simple_query_ios/pubspec.lock b/packages/simple_query_ios/pubspec.lock new file mode 100644 index 0000000..8f3b567 --- /dev/null +++ b/packages/simple_query_ios/pubspec.lock @@ -0,0 +1,387 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "1c5591cc6f252d5f440d96ab87c03e43504be552a3fa49d7cb7563f04c51fb0a" + url: "https://pub.dev" + source: hosted + version: "111.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "6c39bd5486a310e56217bed7cb1691377959f31be4227e41750107db7e6dd55c" + url: "https://pub.dev" + source: hosted + version: "14.7.0" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "44922ecebd8e3d0cef743dadd3b54df4e87e2a4c52a29465a1872aa9e192caa8" + url: "https://pub.dev" + source: hosted + version: "5.1.2" + built_value: + dependency: transitive + description: + name: built_value + sha256: f87ea98192116f7093cb214551ce1929caae0681fdba282b3d8b4462adee7bb7 + url: "https://pub.dev" + source: hosted + version: "8.13.0" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + clock: + dependency: transitive + description: + name: clock + sha256: e51d50bca3217c9a9fa2b41a30e4a38971133f5f9ec7a3d57bae095007f1d28e + url: "https://pub.dev" + source: hosted + version: "1.1.3" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "811709c1badd02fc054039a13f66e0db1961865f9a314175f68c3eaeebec786f" + url: "https://pub.dev" + source: hosted + version: "4.13.0" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + crypto: + dependency: transitive + description: + name: crypto + sha256: e3626ae6270383c9e3a549f34c9e4cd26c09ae6a9adaab2bf4737a00340efdc4 + url: "https://pub.dev" + source: hosted + version: "3.0.8" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: a0e4f65339b31eb6a9e6a12e14b4682a48d46fbc54a82f4a702396fbdbac63a7 + url: "https://pub.dev" + source: hosted + version: "3.1.14" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: "218aeb56050c714f62a3182775320dfa04602b55074873e24e31bbd39bda96fb" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + listen: + dependency: transitive + description: + name: listen + sha256: "47501a08016a43fcad79252439d723f50f14f88fa7bfd8a177e0a417e5c9e1f2" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd" + url: "https://pub.dev" + source: hosted + version: "0.12.20" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + meta: + dependency: "direct main" + description: + name: meta + sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" + url: "https://pub.dev" + source: hosted + version: "1.19.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: ffcf4cf3d6c0b74ac43708d9f56625506e8a68aa935abe9d267a7330f320eb5d + url: "https://pub.dev" + source: hosted + version: "3.0.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + pigeon: + dependency: "direct dev" + description: + name: pigeon + sha256: "5c2ac8dd19571590eaf4c178bf4a093b5646dc376d2d2619943ce2aa0aa860d0" + url: "https://pub.dev" + source: hosted + version: "30.0.4" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "261236774e8b1d69cfc6b9eabbc96c40f25e7a2d6b171f3385d4f65d5734fb24" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + simple_query_platform_interface: + dependency: "direct main" + description: + path: "../simple_query_platform_interface" + relative: true + source: path + version: "0.2.2" + simple_query_shared: + dependency: "direct main" + description: + path: "../simple_query_shared" + relative: true + source: path + version: "0.3.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490" + url: "https://pub.dev" + source: hosted + version: "1.12.2" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "0a10344e901e5b2e63819567951cb6a06673ed6b84f40462188ff5a0c41f371f" + url: "https://pub.dev" + source: hosted + version: "0.7.14" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: fa49e1674cb84acb900141714e6c6e1f9ae099827c24d141430ff6819db4e1bc + url: "https://pub.dev" + source: hosted + version: "2.4.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "89b11d62e1040ee681af3b4f1c97a803ecbf010c6e8b9c5896ee5b08c3bf7b78" + url: "https://pub.dev" + source: hosted + version: "15.4.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: f67cdd8e07d3c6329146aaef1ba043542b3134c12489f553ca9a7435d1068aea + url: "https://pub.dev" + source: hosted + version: "3.1.4" +sdks: + dart: ">=3.13.0 <4.0.0" + flutter: ">=3.47.7" diff --git a/packages/simple_query_ios/pubspec.yaml b/packages/simple_query_ios/pubspec.yaml index e412f6b..b28bcb2 100644 --- a/packages/simple_query_ios/pubspec.yaml +++ b/packages/simple_query_ios/pubspec.yaml @@ -13,20 +13,21 @@ topics: - files environment: - sdk: ^3.6.0 - flutter: '>=3.44.0' + sdk: ^3.13.0 + flutter: '>=3.47.7' dependencies: flutter: sdk: flutter + meta: ^1.17.0 simple_query_platform_interface: ^0.2.0 simple_query_shared: ^0.3.0 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^5.0.0 - pigeon: 22.7.4 + flutter_lints: 6.0.0 + pigeon: 30.0.4 flutter: plugin: diff --git a/packages/simple_query_linux/CHANGELOG.md b/packages/simple_query_linux/CHANGELOG.md index 4830988..056a8d9 100644 --- a/packages/simple_query_linux/CHANGELOG.md +++ b/packages/simple_query_linux/CHANGELOG.md @@ -1,3 +1,8 @@ +## Unreleased + +- **Breaking:** Requires Flutter 3.47.7 / Dart 3.13. Release as a breaking version (the next 0.x minor) (UNFY-412). +- Regenerates the platform channel code with Pigeon 30 (UNFY-412). + ## 0.3.0 - fix(UNFY-265): enforce native filesystem mutation scope diff --git a/packages/simple_query_linux/README.md b/packages/simple_query_linux/README.md index 8a3fb52..51b0265 100644 --- a/packages/simple_query_linux/README.md +++ b/packages/simple_query_linux/README.md @@ -12,7 +12,7 @@ Current implementation: ## Generated Linux bindings -Linux uses Pigeon's GObject backend. The package pins Pigeon 22.7.4, whose +Linux uses Pigeon's GObject backend. The package pins Pigeon 30.0.4, whose GObject generator transfers `GTask` and `GAsyncResult` ownership incorrectly for asynchronous Flutter API calls. Older supported Flutter engines also rely on their channel `finish` call to release an initial task, while newer engines @@ -33,10 +33,9 @@ After `flutter pub get`, regenerate the bindings from this package directory: dart run tool/generate_pigeon.dart ``` -The wrapper uses the package-pinned `dart_style` 3.0.1 library in its 3.6 short -style so the checked-in output is byte-reproducible across supported Flutter -SDKs. This avoids formatter command-line flags that are unavailable in the -minimum Dart 3.6 SDK. The repository-level `tool/regen_pigeon.sh` delegates +The wrapper formats with the package-pinned `dart_style` 3.1.14 library so the +checked-in output is byte-reproducible across supported Flutter SDKs and +matches `dart format`. The repository-level `tool/regen_pigeon.sh` delegates Linux generation to the same wrapper. ## Native tests @@ -83,7 +82,7 @@ application, selects the current local Linux package, and overrides its shared and platform-interface dependencies with the local workspace packages. It builds the real Flutter runner and verifies the generated plugin registrar, then removes the fixture without editing the checkout. Continuous integration -runs this build on the minimum supported Flutter 3.27.0 / Dart 3.6 toolchain; +runs this build on the minimum supported Flutter 3.47.7 / Dart 3.13 toolchain; the current stable toolchain is also covered by the ordinary verification job. This proves compilation and registration wiring, not application deployment or runtime behavior. diff --git a/packages/simple_query_linux/lib/src/generated/native_query.g.dart b/packages/simple_query_linux/lib/src/generated/native_query.g.dart index 160085b..a9b6c16 100644 --- a/packages/simple_query_linux/lib/src/generated/native_query.g.dart +++ b/packages/simple_query_linux/lib/src/generated/native_query.g.dart @@ -1,22 +1,44 @@ -// Autogenerated from Pigeon (v22.7.4), do not edit directly. +// Autogenerated from Pigeon (v30.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers +// ignore_for_file: unused_import, unused_shown_name +// ignore_for_file: type=lint import 'dart:async'; -import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; +import 'dart:typed_data' show Float64List, Int32List, Int64List; -import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; -PlatformException _createConnectionError(String channelName) { - return PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel: "$channelName".', - ); +Object? _extractReplyValueOrThrow( + List? replyList, + String channelName, { + required bool isNullValid, +}) { + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else if (!isNullValid && (replyList.isNotEmpty && replyList[0] == null)) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } + return replyList.firstOrNull; } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({ + Object? result, + PlatformException? error, + bool empty = false, +}) { if (empty) { return []; } @@ -51,16 +73,18 @@ class _PigeonCodec extends StandardMessageCodec { /// /// @throws PlatformException when Linux returns a structured native error. class NativeQueryHostApi { - /// Constructor for [NativeQueryHostApi]. The [binaryMessenger] named argument is - /// available for dependency injection. If it is left null, the default + /// Constructor for [NativeQueryHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - NativeQueryHostApi( - {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? pigeonVar_binaryMessenger; + NativeQueryHostApi({ + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); final String pigeonVar_messageChannelSuffix; @@ -70,33 +94,22 @@ class NativeQueryHostApi { /// @returns A capability payload understood by the shared bridge. /// @throws PlatformException when capability discovery is unavailable. Future> getCapabilities() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_linux.NativeQueryHostApi.getCapabilities$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send(null) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } /// Purpose: Executes a read request against a supported Linux domain. @@ -105,33 +118,24 @@ class NativeQueryHostApi { /// @returns A serialized page of matching records. /// @throws PlatformException for invalid, unsupported, or unavailable reads. Future> query(Map request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_linux.NativeQueryHostApi.query$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } /// Purpose: Executes one filesystem or media mutation on Linux. @@ -140,33 +144,24 @@ class NativeQueryHostApi { /// @returns The serialized mutation result. /// @throws PlatformException for invalid, unsupported, or unavailable writes. Future> mutate(Map request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_linux.NativeQueryHostApi.mutate$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } /// Purpose: Executes an ordered group of Linux mutations. @@ -175,33 +170,24 @@ class NativeQueryHostApi { /// @returns The serialized per-operation results. /// @throws PlatformException when the batch request itself is invalid. Future> batch(Map request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_linux.NativeQueryHostApi.batch$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } /// Purpose: Starts polling a supported Linux domain for changes. @@ -210,32 +196,23 @@ class NativeQueryHostApi { /// @returns The opaque identifier used to stop this observer. /// @throws PlatformException when the domain cannot be observed. Future observeStart(Map request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_linux.NativeQueryHostApi.observeStart$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as String; } /// Purpose: Stops one Linux observer and cancels its pending deliveries. @@ -244,27 +221,22 @@ class NativeQueryHostApi { /// @returns Nothing. /// @throws PlatformException when native cleanup fails. Future observeStop(String observerId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_linux.NativeQueryHostApi.observeStop$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([observerId]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [observerId], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Purpose: Opens a supported Linux file as binary content. @@ -273,34 +245,26 @@ class NativeQueryHostApi { /// @returns A serialized binary-content handle. /// @throws PlatformException when the resource is invalid or unavailable. Future> openBinary( - Map request) async { - final String pigeonVar_channelName = + Map request, + ) async { + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_linux.NativeQueryHostApi.openBinary$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } /// Purpose: Releases a previously opened Linux binary handle. @@ -309,27 +273,22 @@ class NativeQueryHostApi { /// @returns Nothing. /// @throws PlatformException when native cleanup fails. Future closeBinary(String handleId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_linux.NativeQueryHostApi.closeBinary$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([handleId]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [handleId], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Purpose: Calls a namespaced Linux-only diagnostic extension. @@ -340,29 +299,28 @@ class NativeQueryHostApi { /// @returns The serialized extension response, or null when appropriate. /// @throws PlatformException for invalid or unsupported extension calls. Future?> callExtension( - String namespace_, String method, Map? args) async { - final String pigeonVar_channelName = + String namespace_, + String method, + Map? args, + ) async { + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_linux.NativeQueryHostApi.callExtension$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([namespace_, method, args]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as Map?) - ?.cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [namespace_, method, args], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return (pigeonVar_replyValue as Map?) + ?.cast(); } } @@ -383,37 +341,32 @@ abstract class NativeQueryFlutterApi { BinaryMessenger? binaryMessenger, String messageChannelSuffix = '', }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.simple_query_linux.NativeQueryFlutterApi.onObserveEvent$messageChannelSuffix', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); + final pigeonVar_channel = BasicMessageChannel( + 'dev.flutter.pigeon.simple_query_linux.NativeQueryFlutterApi.onObserveEvent$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger, + ); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.simple_query_linux.NativeQueryFlutterApi.onObserveEvent was null.'); - final List args = (message as List?)!; - final String? arg_observerId = (args[0] as String?); - assert(arg_observerId != null, - 'Argument for dev.flutter.pigeon.simple_query_linux.NativeQueryFlutterApi.onObserveEvent was null, expected non-null String.'); - final Map? arg_event = - (args[1] as Map?)?.cast(); - assert(arg_event != null, - 'Argument for dev.flutter.pigeon.simple_query_linux.NativeQueryFlutterApi.onObserveEvent was null, expected non-null Map.'); + final List args = message! as List; + final String arg_observerId = args[0]! as String; + final Map arg_event = + (args[1]! as Map).cast(); try { - api.onObserveEvent(arg_observerId!, arg_event!); + api.onObserveEvent(arg_observerId, arg_event); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); } catch (e) { return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + error: PlatformException(code: 'error', message: e.toString()), + ); } }); } diff --git a/packages/simple_query_linux/linux/native_query.g.cc b/packages/simple_query_linux/linux/native_query.g.cc index b071e33..99b47da 100644 --- a/packages/simple_query_linux/linux/native_query.g.cc +++ b/packages/simple_query_linux/linux/native_query.g.cc @@ -1,7 +1,295 @@ -// Autogenerated from Pigeon (v22.7.4), do not edit directly. +// Autogenerated from Pigeon (v30.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon +#include + +#include #include "native_query.g.h" +/** Purpose: Hash one double so equal values share a hash. @param v is the value to hash. @returns The hash of v. @throws Nothing. */ +static guint G_GNUC_UNUSED flpigeon_hash_double(double v) { + if (std::isnan(v)) { + return static_cast(0x7FF80000); + } + if (v == 0.0) { + v = 0.0; + } + union { double d; uint64_t u; } u; + u.d = v; + return static_cast(u.u ^ (u.u >> 32)); +} +/** Purpose: Compare two doubles, treating NaN as equal to NaN. @param a is the first value. @param b is the second value. @returns TRUE when the values are equal. @throws Nothing. */ +static gboolean G_GNUC_UNUSED flpigeon_equals_double(double a, double b) { + return (a == b) || (std::isnan(a) && std::isnan(b)); +} +/** Purpose: Compare two channel values structurally. @param a is the first value. @param b is the second value. @returns TRUE when both hold equal content. @throws Nothing. */ +static gboolean G_GNUC_UNUSED flpigeon_deep_equals(FlValue* a, FlValue* b) { + if (a == b) { + return TRUE; + } + if (a == nullptr || b == nullptr) { + return FALSE; + } + if (fl_value_get_type(a) != fl_value_get_type(b)) { + return FALSE; + } + switch (fl_value_get_type(a)) { + case FL_VALUE_TYPE_NULL: + return TRUE; + case FL_VALUE_TYPE_BOOL: + return fl_value_get_bool(a) == fl_value_get_bool(b); + case FL_VALUE_TYPE_INT: + return fl_value_get_int(a) == fl_value_get_int(b); + case FL_VALUE_TYPE_FLOAT: { + return flpigeon_equals_double(fl_value_get_float(a), fl_value_get_float(b)); + } + case FL_VALUE_TYPE_STRING: + return g_strcmp0(fl_value_get_string(a), fl_value_get_string(b)) == 0; + case FL_VALUE_TYPE_UINT8_LIST: + return fl_value_get_length(a) == fl_value_get_length(b) && + memcmp(fl_value_get_uint8_list(a), fl_value_get_uint8_list(b), fl_value_get_length(a)) == 0; + case FL_VALUE_TYPE_INT32_LIST: + return fl_value_get_length(a) == fl_value_get_length(b) && + memcmp(fl_value_get_int32_list(a), fl_value_get_int32_list(b), fl_value_get_length(a) * sizeof(int32_t)) == 0; + case FL_VALUE_TYPE_INT64_LIST: + return fl_value_get_length(a) == fl_value_get_length(b) && + memcmp(fl_value_get_int64_list(a), fl_value_get_int64_list(b), fl_value_get_length(a) * sizeof(int64_t)) == 0; + case FL_VALUE_TYPE_FLOAT_LIST: { + size_t len = fl_value_get_length(a); + if (len != fl_value_get_length(b)) { + return FALSE; + } + const double* a_data = fl_value_get_float_list(a); + const double* b_data = fl_value_get_float_list(b); + for (size_t i = 0; i < len; i++) { + if (!flpigeon_equals_double(a_data[i], b_data[i])) { + return FALSE; + } + } + return TRUE; + } + case FL_VALUE_TYPE_LIST: { + size_t len = fl_value_get_length(a); + if (len != fl_value_get_length(b)) { + return FALSE; + } + for (size_t i = 0; i < len; i++) { + if (!flpigeon_deep_equals(fl_value_get_list_value(a, i), fl_value_get_list_value(b, i))) { + return FALSE; + } + } + return TRUE; + } + case FL_VALUE_TYPE_MAP: { + size_t len = fl_value_get_length(a); + if (len != fl_value_get_length(b)) { + return FALSE; + } + for (size_t i = 0; i < len; i++) { + FlValue* key = fl_value_get_map_key(a, i); + FlValue* val = fl_value_get_map_value(a, i); + gboolean found = FALSE; + for (size_t j = 0; j < len; j++) { + FlValue* b_key = fl_value_get_map_key(b, j); + if (flpigeon_deep_equals(key, b_key)) { + FlValue* b_val = fl_value_get_map_value(b, j); + if (flpigeon_deep_equals(val, b_val)) { + found = TRUE; + break; + } else { + return FALSE; + } + } + } + if (!found) { + return FALSE; + } + } + return TRUE; + } + default: + return FALSE; + } + return FALSE; +} +/** Purpose: Hash one channel value structurally. @param value is the value to hash. @returns A hash consistent with structural equality. @throws Nothing. */ +static guint G_GNUC_UNUSED flpigeon_deep_hash(FlValue* value) { + if (value == nullptr) { + return 0; + } + switch (fl_value_get_type(value)) { + case FL_VALUE_TYPE_NULL: + return 0; + case FL_VALUE_TYPE_BOOL: + return fl_value_get_bool(value) ? 1231 : 1237; + case FL_VALUE_TYPE_INT: { + int64_t v = fl_value_get_int(value); + return static_cast(v ^ (v >> 32)); + } + case FL_VALUE_TYPE_FLOAT: + return flpigeon_hash_double(fl_value_get_float(value)); + case FL_VALUE_TYPE_STRING: + return g_str_hash(fl_value_get_string(value)); + case FL_VALUE_TYPE_UINT8_LIST: { + guint result = 1; + size_t len = fl_value_get_length(value); + const uint8_t* data = fl_value_get_uint8_list(value); + for (size_t i = 0; i < len; i++) { + result = result * 31 + data[i]; + } + return result; + } + case FL_VALUE_TYPE_INT32_LIST: { + guint result = 1; + size_t len = fl_value_get_length(value); + const int32_t* data = fl_value_get_int32_list(value); + for (size_t i = 0; i < len; i++) { + result = result * 31 + static_cast(data[i]); + } + return result; + } + case FL_VALUE_TYPE_INT64_LIST: { + guint result = 1; + size_t len = fl_value_get_length(value); + const int64_t* data = fl_value_get_int64_list(value); + for (size_t i = 0; i < len; i++) { + result = result * 31 + static_cast(data[i] ^ (data[i] >> 32)); + } + return result; + } + case FL_VALUE_TYPE_FLOAT_LIST: { + guint result = 1; + size_t len = fl_value_get_length(value); + const double* data = fl_value_get_float_list(value); + for (size_t i = 0; i < len; i++) { + result = result * 31 + flpigeon_hash_double(data[i]); + } + return result; + } + case FL_VALUE_TYPE_LIST: { + guint result = 1; + size_t len = fl_value_get_length(value); + for (size_t i = 0; i < len; i++) { + result = result * 31 + flpigeon_deep_hash(fl_value_get_list_value(value, i)); + } + return result; + } + case FL_VALUE_TYPE_MAP: { + guint result = 0; + size_t len = fl_value_get_length(value); + for (size_t i = 0; i < len; i++) { + result += ((flpigeon_deep_hash(fl_value_get_map_key(value, i)) * 31) ^ flpigeon_deep_hash(fl_value_get_map_value(value, i))); + } + return result; + } + default: + return static_cast(fl_value_get_type(value)); + } + return 0; +} +/** Purpose: Describe one channel value as text. @param value is the value to describe. @returns A newly allocated string the caller frees. @throws Nothing. */ +static gchar* G_GNUC_UNUSED flpigeon_to_string(FlValue* value) { + if (value == nullptr) { + return g_strdup("null"); + } + switch (fl_value_get_type(value)) { + case FL_VALUE_TYPE_NULL: + return g_strdup("null"); + case FL_VALUE_TYPE_BOOL: + return g_strdup(fl_value_get_bool(value) ? "true" : "false"); + case FL_VALUE_TYPE_INT: + return g_strdup_printf("%" G_GINT64_FORMAT, fl_value_get_int(value)); + case FL_VALUE_TYPE_FLOAT: + return g_strdup_printf("%g", fl_value_get_float(value)); + case FL_VALUE_TYPE_STRING: + return g_strdup_printf("\"%s\"", fl_value_get_string(value)); + case FL_VALUE_TYPE_UINT8_LIST: { + GString* str = g_string_new("["); + size_t len = fl_value_get_length(value); + const uint8_t* data = fl_value_get_uint8_list(value); + for (size_t i = 0; i < len; i++) { + if (i > 0) { + g_string_append(str, ", "); + } + g_string_append_printf(str, "%d", data[i]); + } + g_string_append(str, "]"); + return g_string_free(str, FALSE); + } + case FL_VALUE_TYPE_INT32_LIST: { + GString* str = g_string_new("["); + size_t len = fl_value_get_length(value); + const int32_t* data = fl_value_get_int32_list(value); + for (size_t i = 0; i < len; i++) { + if (i > 0) { + g_string_append(str, ", "); + } + g_string_append_printf(str, "%d", data[i]); + } + g_string_append(str, "]"); + return g_string_free(str, FALSE); + } + case FL_VALUE_TYPE_INT64_LIST: { + GString* str = g_string_new("["); + size_t len = fl_value_get_length(value); + const int64_t* data = fl_value_get_int64_list(value); + for (size_t i = 0; i < len; i++) { + if (i > 0) { + g_string_append(str, ", "); + } + g_string_append_printf(str, "%" G_GINT64_FORMAT, data[i]); + } + g_string_append(str, "]"); + return g_string_free(str, FALSE); + } + case FL_VALUE_TYPE_FLOAT_LIST: { + GString* str = g_string_new("["); + size_t len = fl_value_get_length(value); + const double* data = fl_value_get_float_list(value); + for (size_t i = 0; i < len; i++) { + if (i > 0) { + g_string_append(str, ", "); + } + g_string_append_printf(str, "%g", data[i]); + } + g_string_append(str, "]"); + return g_string_free(str, FALSE); + } + case FL_VALUE_TYPE_LIST: { + GString* str = g_string_new("["); + size_t len = fl_value_get_length(value); + for (size_t i = 0; i < len; i++) { + if (i > 0) { + g_string_append(str, ", "); + } + gchar* item_str = flpigeon_to_string(fl_value_get_list_value(value, i)); + g_string_append(str, item_str); + g_free(item_str); + } + g_string_append(str, "]"); + return g_string_free(str, FALSE); + } + case FL_VALUE_TYPE_MAP: { + GString* str = g_string_new("{"); + size_t len = fl_value_get_length(value); + for (size_t i = 0; i < len; i++) { + if (i > 0) { + g_string_append(str, ", "); + } + gchar* key_str = flpigeon_to_string(fl_value_get_map_key(value, i)); + gchar* val_str = flpigeon_to_string(fl_value_get_map_value(value, i)); + g_string_append_printf(str, "%s: %s", key_str, val_str); + g_free(key_str); + g_free(val_str); + } + g_string_append(str, "}"); + return g_string_free(str, FALSE); + } + default: + return g_strdup("[custom]"); + } + return g_strdup("null"); +} + /** Purpose: Store generated MessageCodec state across its GObject lifecycle. @param parent_instance anchors the state in FlStandardMessageCodec. @returns Instances retain generated channel data until disposal. @throws Nothing. */ struct _SqlqMessageCodec { @@ -11,6 +299,7 @@ struct _SqlqMessageCodec { G_DEFINE_TYPE(SqlqMessageCodec, sqlq_message_codec, fl_standard_message_codec_get_type()) + /** Purpose: Encode one generated channel value. @param codec is the active codec. @param buffer receives bytes. @param value is encoded. @param error receives failure. @returns TRUE on success. @throws Nothing. */ static gboolean sqlq_message_codec_write_value(FlStandardMessageCodec* codec, GByteArray* buffer, FlValue* value, GError** error) { if (fl_value_get_type(value) == FL_VALUE_TYPE_CUSTOM) { diff --git a/packages/simple_query_linux/linux/native_query.g.h b/packages/simple_query_linux/linux/native_query.g.h index 1c28fa7..f92f91d 100644 --- a/packages/simple_query_linux/linux/native_query.g.h +++ b/packages/simple_query_linux/linux/native_query.g.h @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v22.7.4), do not edit directly. +// Autogenerated from Pigeon (v30.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon #ifndef PIGEON_NATIVE_QUERY_G_H_ diff --git a/packages/simple_query_linux/pubspec.lock b/packages/simple_query_linux/pubspec.lock new file mode 100644 index 0000000..5f7a4b2 --- /dev/null +++ b/packages/simple_query_linux/pubspec.lock @@ -0,0 +1,387 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "1c5591cc6f252d5f440d96ab87c03e43504be552a3fa49d7cb7563f04c51fb0a" + url: "https://pub.dev" + source: hosted + version: "111.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "6c39bd5486a310e56217bed7cb1691377959f31be4227e41750107db7e6dd55c" + url: "https://pub.dev" + source: hosted + version: "14.7.0" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "44922ecebd8e3d0cef743dadd3b54df4e87e2a4c52a29465a1872aa9e192caa8" + url: "https://pub.dev" + source: hosted + version: "5.1.2" + built_value: + dependency: transitive + description: + name: built_value + sha256: f87ea98192116f7093cb214551ce1929caae0681fdba282b3d8b4462adee7bb7 + url: "https://pub.dev" + source: hosted + version: "8.13.0" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + clock: + dependency: transitive + description: + name: clock + sha256: e51d50bca3217c9a9fa2b41a30e4a38971133f5f9ec7a3d57bae095007f1d28e + url: "https://pub.dev" + source: hosted + version: "1.1.3" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "811709c1badd02fc054039a13f66e0db1961865f9a314175f68c3eaeebec786f" + url: "https://pub.dev" + source: hosted + version: "4.13.0" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + crypto: + dependency: transitive + description: + name: crypto + sha256: e3626ae6270383c9e3a549f34c9e4cd26c09ae6a9adaab2bf4737a00340efdc4 + url: "https://pub.dev" + source: hosted + version: "3.0.8" + dart_style: + dependency: "direct dev" + description: + name: dart_style + sha256: a0e4f65339b31eb6a9e6a12e14b4682a48d46fbc54a82f4a702396fbdbac63a7 + url: "https://pub.dev" + source: hosted + version: "3.1.14" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: "218aeb56050c714f62a3182775320dfa04602b55074873e24e31bbd39bda96fb" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + listen: + dependency: transitive + description: + name: listen + sha256: "47501a08016a43fcad79252439d723f50f14f88fa7bfd8a177e0a417e5c9e1f2" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd" + url: "https://pub.dev" + source: hosted + version: "0.12.20" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + meta: + dependency: "direct main" + description: + name: meta + sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" + url: "https://pub.dev" + source: hosted + version: "1.19.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: ffcf4cf3d6c0b74ac43708d9f56625506e8a68aa935abe9d267a7330f320eb5d + url: "https://pub.dev" + source: hosted + version: "3.0.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + pigeon: + dependency: "direct dev" + description: + name: pigeon + sha256: "5c2ac8dd19571590eaf4c178bf4a093b5646dc376d2d2619943ce2aa0aa860d0" + url: "https://pub.dev" + source: hosted + version: "30.0.4" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pub_semver: + dependency: "direct dev" + description: + name: pub_semver + sha256: "261236774e8b1d69cfc6b9eabbc96c40f25e7a2d6b171f3385d4f65d5734fb24" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + simple_query_platform_interface: + dependency: "direct main" + description: + path: "../simple_query_platform_interface" + relative: true + source: path + version: "0.2.2" + simple_query_shared: + dependency: "direct main" + description: + path: "../simple_query_shared" + relative: true + source: path + version: "0.3.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490" + url: "https://pub.dev" + source: hosted + version: "1.12.2" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "0a10344e901e5b2e63819567951cb6a06673ed6b84f40462188ff5a0c41f371f" + url: "https://pub.dev" + source: hosted + version: "0.7.14" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: fa49e1674cb84acb900141714e6c6e1f9ae099827c24d141430ff6819db4e1bc + url: "https://pub.dev" + source: hosted + version: "2.4.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "89b11d62e1040ee681af3b4f1c97a803ecbf010c6e8b9c5896ee5b08c3bf7b78" + url: "https://pub.dev" + source: hosted + version: "15.4.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: f67cdd8e07d3c6329146aaef1ba043542b3134c12489f553ca9a7435d1068aea + url: "https://pub.dev" + source: hosted + version: "3.1.4" +sdks: + dart: ">=3.13.0 <4.0.0" + flutter: ">=3.47.7" diff --git a/packages/simple_query_linux/pubspec.yaml b/packages/simple_query_linux/pubspec.yaml index 38263b4..fea4418 100644 --- a/packages/simple_query_linux/pubspec.yaml +++ b/packages/simple_query_linux/pubspec.yaml @@ -13,21 +13,23 @@ topics: - files environment: - sdk: ^3.6.0 - flutter: '>=3.24.0' + sdk: ^3.13.0 + flutter: '>=3.47.7' dependencies: flutter: sdk: flutter + meta: ^1.17.0 simple_query_platform_interface: ^0.2.0 simple_query_shared: ^0.3.0 dev_dependencies: - dart_style: 3.0.1 + dart_style: 3.1.14 + pub_semver: 2.2.1 flutter_test: sdk: flutter - flutter_lints: ^5.0.0 - pigeon: 22.7.4 + flutter_lints: 6.0.0 + pigeon: 30.0.4 flutter: plugin: diff --git a/packages/simple_query_linux/test/pigeon_generation_test.dart b/packages/simple_query_linux/test/pigeon_generation_test.dart index b5d7dae..459fc31 100644 --- a/packages/simple_query_linux/test/pigeon_generation_test.dart +++ b/packages/simple_query_linux/test/pigeon_generation_test.dart @@ -132,7 +132,7 @@ void main() { final linuxSources = '$header\n$source'; expect( expectGeneratedDocumentation(source), - (functions: 80, structures: 13), + (functions: 85, structures: 13), reason: 'Generated definition inventory changed; audit every new entry.', ); diff --git a/packages/simple_query_linux/tool/generate_pigeon.dart b/packages/simple_query_linux/tool/generate_pigeon.dart index d169b0b..b126244 100644 --- a/packages/simple_query_linux/tool/generate_pigeon.dart +++ b/packages/simple_query_linux/tool/generate_pigeon.dart @@ -2,8 +2,13 @@ import 'dart:convert'; import 'dart:io'; import 'package:dart_style/dart_style.dart'; +import 'package:pub_semver/pub_semver.dart'; -const _pigeonVersion = '22.7.4'; +const _pigeonVersion = '30.0.4'; + +// The package language version, which is what `dart format` applies to the +// checked-in output. Keep it equal to the SDK floor in pubspec.yaml. +final _dartLanguageVersion = Version(3, 13, 0); /// Purpose: Replace one pinned generator fragment and fail closed on drift. /// @@ -13,12 +18,12 @@ const _pigeonVersion = '22.7.4'; /// @param description identifies the repair when validation fails. /// @returns The source with exactly one replacement. /// @throws StateError when the pinned upstream source no longer matches. -String _replaceExactlyOnce( - String source, - String before, - String after, - String description, -) { +String _replaceExactlyOnce({ + required String source, + required String before, + required String after, + required String description, +}) { final matches = before.allMatches(source).length; if (matches != 1) { throw StateError( @@ -58,14 +63,16 @@ Future _copyDirectory(Directory source, Directory destination) async { /// @throws StateError when the pinned generator source has drifted. String _patchFlutterApiCallback(String source) { return _replaceExactlyOnce( - source, - r''' indent.writeScoped( - 'static void ${methodPrefix}_${methodName}_cb(GObject* object, GAsyncResult* result, gpointer user_data) {', - '}', () { - indent.writeln('GTask* task = G_TASK(user_data);'); - indent.writeln('g_task_return_pointer(task, result, g_object_unref);'); - });''', - r''' indent.writeln( + source: source, + before: r''' indent.writeScoped( + 'static void ${methodPrefix}_${methodName}_cb(GObject* object, GAsyncResult* result, gpointer user_data) {', + '}', + () { + indent.writeln('GTask* task = G_TASK(user_data);'); + indent.writeln('g_task_return_pointer(task, result, g_object_unref);'); + }, + );''', + after: r''' indent.writeln( '/** Purpose: Finish one generated FlutterApi transport send. @param object is the messenger. @param result is its asynchronous response. @param user_data owns the forwarding task. @returns Nothing. @throws Nothing. */'); indent.writeScoped( 'static void ${methodPrefix}_${methodName}_cb(GObject* object, GAsyncResult* result, gpointer user_data) {', @@ -107,7 +114,7 @@ String _patchFlutterApiCallback(String source) { indent.writeln( 'g_task_return_pointer(task, response, reinterpret_cast(fl_value_unref));'); });''', - 'FlutterApi transport callback', + description: 'FlutterApi transport callback', ); } @@ -118,15 +125,16 @@ String _patchFlutterApiCallback(String source) { /// @throws StateError when the pinned generator source has drifted. String _patchFlutterApiSend(String source) { return _replaceExactlyOnce( - source, - r''' indent.writeln( - 'FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec));'); - indent.writeln( - 'GTask* task = g_task_new(self, cancellable, callback, user_data);'); + source: source, + before: r''' indent.writeln( + 'FlBasicMessageChannel* channel = fl_basic_message_channel_new(self->messenger, channel_name, FL_MESSAGE_CODEC(codec));', + ); + indent.writeln('GTask* task = g_task_new(self, cancellable, callback, user_data);'); indent.writeln('g_task_set_task_data(task, channel, g_object_unref);'); indent.writeln( - 'fl_basic_message_channel_send(channel, args, cancellable, ${methodPrefix}_${methodName}_cb, task);');''', - r''' indent.writeln('g_autoptr(GError) error = nullptr;'); + 'fl_basic_message_channel_send(channel, args, cancellable, ${methodPrefix}_${methodName}_cb, task);', + );''', + after: r''' indent.writeln('g_autoptr(GError) error = nullptr;'); indent.writeln( 'g_autoptr(GBytes) message = fl_message_codec_encode_message(FL_MESSAGE_CODEC(codec), args, &error);'); indent.writeln( @@ -145,7 +153,7 @@ String _patchFlutterApiSend(String source) { }); indent.writeln( 'fl_binary_messenger_send_on_channel(self->messenger, channel_name, message, cancellable, ${methodPrefix}_${methodName}_cb, g_steal_pointer(&task));');''', - 'FlutterApi messenger send', + description: 'FlutterApi messenger send', ); } @@ -156,24 +164,28 @@ String _patchFlutterApiSend(String source) { /// @throws StateError when the pinned generator source has drifted. String _patchFlutterApiFinish(String source) { return _replaceExactlyOnce( - source, - r''' indent.writeln('g_autoptr(GTask) task = G_TASK(result);'); - indent.writeln( - 'GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr));'); - indent.writeln( - 'FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task));'); - indent.writeln( - 'g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error);'); - indent.writeScoped('if (response == nullptr) { ', '}', () { - indent.writeln('return nullptr;'); - });''', - r''' indent.writeln('GTask* task = G_TASK(result);'); + source: source, + before: + r''' indent.writeln('g_autoptr(GTask) task = G_TASK(result);'); + indent.writeln( + 'GAsyncResult* r = G_ASYNC_RESULT(g_task_propagate_pointer(task, nullptr));', + ); + indent.writeln( + 'FlBasicMessageChannel* channel = FL_BASIC_MESSAGE_CHANNEL(g_task_get_task_data(task));', + ); + indent.writeln( + 'g_autoptr(FlValue) response = fl_basic_message_channel_send_finish(channel, r, error);', + ); + indent.writeScoped('if (response == nullptr) { ', '}', () { + indent.writeln('return nullptr;'); + });''', + after: r''' indent.writeln('GTask* task = G_TASK(result);'); indent.writeln( 'g_autoptr(FlValue) response = static_cast(g_task_propagate_pointer(task, error));'); indent.writeScoped('if (response == nullptr) {', '}', () { indent.writeln('return nullptr;'); });''', - 'FlutterApi response finish', + description: 'FlutterApi response finish', ); } @@ -196,12 +208,12 @@ String _patchFlutterApiTransport(String source) { /// @throws StateError when the pinned generator source has drifted. String _patchStructureDocumentation(String source) { return _replaceExactlyOnce( - source, - r''' indent.writeScoped('struct _$className {', '};', () {''', - r''' indent.writeln( + source: source, + before: r''' indent.writeScoped('struct _$className {', '};', () {''', + after: r''' indent.writeln( '/** Purpose: Store generated $name state across its GObject lifecycle. @param parent_instance anchors the state in $parentClassName. @returns Instances retain generated channel data until disposal. @throws Nothing. */'); indent.writeScoped('struct _$className {', '};', () {''', - 'generated GObject structure documentation', + description: 'generated GObject structure documentation', ); } @@ -212,34 +224,28 @@ String _patchStructureDocumentation(String source) { /// @throws StateError when the pinned generator source has drifted. String _patchLifecycleDocumentation(String source) { var patched = _replaceExactlyOnce( - source, - r''' indent.writeScoped( - 'static void ${methodPrefix}_dispose(GObject* object) {', '}', () {''', - r''' indent.writeln( + source: source, + before: r''' indent.writeScoped('static void ${methodPrefix}_dispose(GObject* object) {', '}', () {''', + after: r''' indent.writeln( '/** Purpose: Release generated $name resources. @param object owns the instance. @returns Nothing. @throws Nothing. */'); - indent.writeScoped( - 'static void ${methodPrefix}_dispose(GObject* object) {', '}', () {''', - 'generated GObject disposal documentation', + indent.writeScoped('static void ${methodPrefix}_dispose(GObject* object) {', '}', () {''', + description: 'generated GObject disposal documentation', ); patched = _replaceExactlyOnce( - patched, - r''' indent.writeScoped( - 'static void ${methodPrefix}_init($className* self) {', '}', () {''', - r''' indent.writeln( + source: patched, + before: r''' indent.writeScoped('static void ${methodPrefix}_init($className* self) {', '}', () {''', + after: r''' indent.writeln( '/** Purpose: Initialize generated $name state. @param self is the new instance. @returns Nothing. @throws Nothing. */'); - indent.writeScoped( - 'static void ${methodPrefix}_init($className* self) {', '}', () {''', - 'generated GObject initialization documentation', + indent.writeScoped('static void ${methodPrefix}_init($className* self) {', '}', () {''', + description: 'generated GObject initialization documentation', ); return _replaceExactlyOnce( - patched, - r''' indent.writeScoped( - 'static void ${methodPrefix}_class_init(${className}Class* klass) {', '}',''', - r''' indent.writeln( + source: patched, + before: r''' indent.writeScoped('static void ${methodPrefix}_class_init(${className}Class* klass) {', '}', () {''', + after: r''' indent.writeln( '/** Purpose: Bind generated $name lifecycle methods. @param klass is the generated class. @returns Nothing. @throws Nothing. */'); - indent.writeScoped( - 'static void ${methodPrefix}_class_init(${className}Class* klass) {', '}',''', - 'generated GObject class documentation', + indent.writeScoped('static void ${methodPrefix}_class_init(${className}Class* klass) {', '}', () {''', + description: 'generated GObject class documentation', ); } @@ -250,34 +256,32 @@ String _patchLifecycleDocumentation(String source) { /// @throws StateError when the pinned generator source has drifted. String _patchCodecDocumentation(String source) { var patched = _replaceExactlyOnce( - source, - r''' indent.writeScoped( - 'static gboolean ${codecMethodPrefix}_write_value($_standardCodecName* codec, GByteArray* buffer, FlValue* value, GError** error) {',''', - r''' indent.writeln( + source: source, + before: r''' indent.writeScoped( + 'static gboolean ${codecMethodPrefix}_write_value($_standardCodecName* codec, GByteArray* buffer, FlValue* value, GError** error) {',''', + after: r''' indent.writeln( '/** Purpose: Encode one generated channel value. @param codec is the active codec. @param buffer receives bytes. @param value is encoded. @param error receives failure. @returns TRUE on success. @throws Nothing. */'); indent.writeScoped( - 'static gboolean ${codecMethodPrefix}_write_value($_standardCodecName* codec, GByteArray* buffer, FlValue* value, GError** error) {',''', - 'generated codec writer documentation', + 'static gboolean ${codecMethodPrefix}_write_value($_standardCodecName* codec, GByteArray* buffer, FlValue* value, GError** error) {',''', + description: 'generated codec writer documentation', ); patched = _replaceExactlyOnce( - patched, - r''' indent.writeScoped( - 'static FlValue* ${codecMethodPrefix}_read_value_of_type($_standardCodecName* codec, GBytes* buffer, size_t* offset, int type, GError** error) {',''', - r''' indent.writeln( + source: patched, + before: r''' indent.writeScoped( + 'static FlValue* ${codecMethodPrefix}_read_value_of_type($_standardCodecName* codec, GBytes* buffer, size_t* offset, int type, GError** error) {',''', + after: r''' indent.writeln( '/** Purpose: Decode one generated channel value. @param codec is the active codec. @param buffer supplies bytes. @param offset advances after decoding. @param type selects the value codec. @param error receives failure. @returns A newly owned value or null. @throws Nothing. */'); indent.writeScoped( - 'static FlValue* ${codecMethodPrefix}_read_value_of_type($_standardCodecName* codec, GBytes* buffer, size_t* offset, int type, GError** error) {',''', - 'generated codec reader documentation', + 'static FlValue* ${codecMethodPrefix}_read_value_of_type($_standardCodecName* codec, GBytes* buffer, size_t* offset, int type, GError** error) {',''', + description: 'generated codec reader documentation', ); return _replaceExactlyOnce( - patched, - r''' indent.writeScoped( - 'static $codecClassName* ${codecMethodPrefix}_new() {', '}', () {''', - r''' indent.writeln( + source: patched, + before: r''' indent.writeScoped('static $codecClassName* ${codecMethodPrefix}_new() {', '}', () {''', + after: r''' indent.writeln( '/** Purpose: Create the generated channel codec. @param None. @returns A newly owned codec. @throws Nothing. */'); - indent.writeScoped( - 'static $codecClassName* ${codecMethodPrefix}_new() {', '}', () {''', - 'generated codec constructor documentation', + indent.writeScoped('static $codecClassName* ${codecMethodPrefix}_new() {', '}', () {''', + description: 'generated codec constructor documentation', ); } @@ -288,10 +292,10 @@ String _patchCodecDocumentation(String source) { /// @throws StateError when the pinned generator source has drifted. String _patchHostResponseDocumentation(String source) { final patched = _replaceExactlyOnce( - source, - r''' indent.writeScoped( - "${method.isAsynchronous ? 'static ' : ''}$responseClassName* ${responseMethodPrefix}_new(${constructorArgs.join(', ')}) {",''', - r''' indent.writeln('/**'); + source: source, + before: r''' indent.writeScoped( + "${method.isAsynchronous ? 'static ' : ''}$responseClassName* ${responseMethodPrefix}_new(${constructorArgs.join(', ')}) {",''', + after: r''' indent.writeln('/**'); indent.writeln( ' * Purpose: Build a successful generated $responseName host response.'); if (constructorArgs.isEmpty) { @@ -308,18 +312,18 @@ String _patchHostResponseDocumentation(String source) { indent.writeln(' * @throws Nothing.'); indent.writeln(' */'); indent.writeScoped( - "${method.isAsynchronous ? 'static ' : ''}$responseClassName* ${responseMethodPrefix}_new(${constructorArgs.join(', ')}) {",''', - 'generated HostApi success constructor documentation', + "${method.isAsynchronous ? 'static ' : ''}$responseClassName* ${responseMethodPrefix}_new(${constructorArgs.join(', ')}) {",''', + description: 'generated HostApi success constructor documentation', ); return _replaceExactlyOnce( - patched, - r''' indent.writeScoped( - '${method.isAsynchronous ? 'static ' : ''}$responseClassName* ${responseMethodPrefix}_new_error(const gchar* code, const gchar* message, FlValue* details) {',''', - r''' indent.writeln( + source: patched, + before: r''' indent.writeScoped( + '${method.isAsynchronous ? 'static ' : ''}$responseClassName* ${responseMethodPrefix}_new_error(const gchar* code, const gchar* message, FlValue* details) {',''', + after: r''' indent.writeln( '/** Purpose: Build a generated $responseName host error. @param code identifies the stable error. @param message explains the failure. @param details carries optional structured context. @returns A newly owned $responseClassName. @throws Nothing. */'); indent.writeScoped( - '${method.isAsynchronous ? 'static ' : ''}$responseClassName* ${responseMethodPrefix}_new_error(const gchar* code, const gchar* message, FlValue* details) {',''', - 'generated HostApi error constructor documentation', + '${method.isAsynchronous ? 'static ' : ''}$responseClassName* ${responseMethodPrefix}_new_error(const gchar* code, const gchar* message, FlValue* details) {',''', + description: 'generated HostApi error constructor documentation', ); } @@ -330,14 +334,14 @@ String _patchHostResponseDocumentation(String source) { /// @throws StateError when the pinned generator source has drifted. String _patchHostCallbackDocumentation(String source) { return _replaceExactlyOnce( - source, - r''' indent.writeScoped( - 'static void ${methodPrefix}_${methodName}_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) {',''', - r''' indent.writeln( + source: source, + before: r''' indent.writeScoped( + 'static void ${methodPrefix}_${methodName}_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) {',''', + after: r''' indent.writeln( '/** Purpose: Decode and dispatch one generated host call. @param channel carries the call. @param message_ contains arguments. @param response_handle receives the reply. @param user_data owns API state. @returns Nothing. @throws Nothing. */'); indent.writeScoped( - 'static void ${methodPrefix}_${methodName}_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) {',''', - 'generated host callback documentation', + 'static void ${methodPrefix}_${methodName}_cb(FlBasicMessageChannel* channel, FlValue* message_, FlBasicMessageChannelResponseHandle* response_handle, gpointer user_data) {',''', + description: 'generated host callback documentation', ); } @@ -348,34 +352,34 @@ String _patchHostCallbackDocumentation(String source) { /// @throws StateError when the pinned generator source has drifted. String _patchHostSetupDocumentation(String source) { var patched = _replaceExactlyOnce( - source, - r''' indent.writeScoped( - 'static $className* ${methodPrefix}_new(const $vtableName* vtable, gpointer user_data, GDestroyNotify user_data_free_func) {',''', - r''' indent.writeln( + source: source, + before: r''' indent.writeScoped( + 'static $className* ${methodPrefix}_new(const $vtableName* vtable, gpointer user_data, GDestroyNotify user_data_free_func) {',''', + after: r''' indent.writeln( '/** Purpose: Bind generated HostApi callbacks to their owned context. @param vtable dispatches host methods. @param user_data is passed to callbacks. @param user_data_free_func releases callback context. @returns A newly owned $className. @throws Nothing. */'); indent.writeScoped( - 'static $className* ${methodPrefix}_new(const $vtableName* vtable, gpointer user_data, GDestroyNotify user_data_free_func) {',''', - 'generated HostApi state constructor documentation', + 'static $className* ${methodPrefix}_new(const $vtableName* vtable, gpointer user_data, GDestroyNotify user_data_free_func) {',''', + description: 'generated HostApi state constructor documentation', ); patched = _replaceExactlyOnce( - patched, - r''' indent.writeScoped( - 'void ${methodPrefix}_set_method_handlers(FlBinaryMessenger* messenger, const gchar* suffix, const $vtableName* vtable, gpointer user_data, GDestroyNotify user_data_free_func) {',''', - r''' indent.writeln( + source: patched, + before: r''' indent.writeScoped( + 'void ${methodPrefix}_set_method_handlers(FlBinaryMessenger* messenger, const gchar* suffix, const $vtableName* vtable, gpointer user_data, GDestroyNotify user_data_free_func) {',''', + after: r''' indent.writeln( '/** Purpose: Register every generated HostApi channel handler. @param messenger owns channel registrations. @param suffix scopes channel names. @param vtable dispatches host methods. @param user_data is passed to callbacks. @param user_data_free_func releases callback context. @returns Nothing. @throws Nothing. */'); indent.writeScoped( - 'void ${methodPrefix}_set_method_handlers(FlBinaryMessenger* messenger, const gchar* suffix, const $vtableName* vtable, gpointer user_data, GDestroyNotify user_data_free_func) {',''', - 'generated HostApi handler registration documentation', + 'void ${methodPrefix}_set_method_handlers(FlBinaryMessenger* messenger, const gchar* suffix, const $vtableName* vtable, gpointer user_data, GDestroyNotify user_data_free_func) {',''', + description: 'generated HostApi handler registration documentation', ); return _replaceExactlyOnce( - patched, - r''' indent.writeScoped( - 'void ${methodPrefix}_clear_method_handlers(FlBinaryMessenger* messenger, const gchar* suffix) {',''', - r''' indent.writeln( + source: patched, + before: r''' indent.writeScoped( + 'void ${methodPrefix}_clear_method_handlers(FlBinaryMessenger* messenger, const gchar* suffix) {',''', + after: r''' indent.writeln( '/** Purpose: Remove every generated HostApi channel handler. @param messenger owns channel registrations. @param suffix scopes channel names. @returns Nothing. @throws Nothing. */'); indent.writeScoped( - 'void ${methodPrefix}_clear_method_handlers(FlBinaryMessenger* messenger, const gchar* suffix) {',''', - 'generated HostApi handler cleanup documentation', + 'void ${methodPrefix}_clear_method_handlers(FlBinaryMessenger* messenger, const gchar* suffix) {',''', + description: 'generated HostApi handler cleanup documentation', ); } @@ -386,24 +390,24 @@ String _patchHostSetupDocumentation(String source) { /// @throws StateError when the pinned generator source has drifted. String _patchFlutterObjectDocumentation(String source) { final patched = _replaceExactlyOnce( - source, - r''' indent.writeScoped( - '$className* ${methodPrefix}_new(FlBinaryMessenger* messenger, const gchar* suffix) {',''', - r''' indent.writeln( + source: source, + before: r''' indent.writeScoped( + '$className* ${methodPrefix}_new(FlBinaryMessenger* messenger, const gchar* suffix) {',''', + after: r''' indent.writeln( '/** Purpose: Create a generated FlutterApi transport client. @param messenger carries generated calls. @param suffix scopes channel names. @returns A newly owned $className. @throws Nothing. */'); indent.writeScoped( - '$className* ${methodPrefix}_new(FlBinaryMessenger* messenger, const gchar* suffix) {',''', - 'generated FlutterApi constructor documentation', + '$className* ${methodPrefix}_new(FlBinaryMessenger* messenger, const gchar* suffix) {',''', + description: 'generated FlutterApi constructor documentation', ); return _replaceExactlyOnce( - patched, - r''' indent.writeScoped( - 'static $responseClassName* ${responseMethodPrefix}_new(FlValue* response) {',''', - r''' indent.writeln( + source: patched, + before: r''' indent.writeScoped( + 'static $responseClassName* ${responseMethodPrefix}_new(FlValue* response) {',''', + after: r''' indent.writeln( '/** Purpose: Decode one generated FlutterApi response envelope. @param response contains the returned value or error. @returns A newly owned $responseClassName. @throws Nothing. */'); indent.writeScoped( - 'static $responseClassName* ${responseMethodPrefix}_new(FlValue* response) {',''', - 'generated FlutterApi response constructor documentation', + 'static $responseClassName* ${responseMethodPrefix}_new(FlValue* response) {',''', + description: 'generated FlutterApi response constructor documentation', ); } @@ -414,44 +418,44 @@ String _patchFlutterObjectDocumentation(String source) { /// @throws StateError when the pinned generator source has drifted. String _patchFlutterAccessorDocumentation(String source) { var patched = _replaceExactlyOnce( - source, - r''' indent.writeScoped( - 'gboolean ${responseMethodPrefix}_is_error($responseClassName* self) {',''', - r''' indent.writeln( + source: source, + before: r''' indent.writeScoped( + 'gboolean ${responseMethodPrefix}_is_error($responseClassName* self) {',''', + after: r''' indent.writeln( '/** Purpose: Report whether a generated FlutterApi response is an error. @param self is the decoded response. @returns TRUE for an error envelope. @throws Nothing. */'); indent.writeScoped( - 'gboolean ${responseMethodPrefix}_is_error($responseClassName* self) {',''', - 'generated FlutterApi error predicate documentation', + 'gboolean ${responseMethodPrefix}_is_error($responseClassName* self) {',''', + description: 'generated FlutterApi error predicate documentation', ); patched = _replaceExactlyOnce( - patched, - r''' indent.writeScoped( - 'const gchar* ${responseMethodPrefix}_get_error_code($responseClassName* self) {',''', - r''' indent.writeln( + source: patched, + before: r''' indent.writeScoped( + 'const gchar* ${responseMethodPrefix}_get_error_code($responseClassName* self) {',''', + after: r''' indent.writeln( '/** Purpose: Read the stable code from a generated FlutterApi error. @param self is an error response. @returns A borrowed error code. @throws Nothing; self must contain an error. */'); indent.writeScoped( - 'const gchar* ${responseMethodPrefix}_get_error_code($responseClassName* self) {',''', - 'generated FlutterApi error code documentation', + 'const gchar* ${responseMethodPrefix}_get_error_code($responseClassName* self) {',''', + description: 'generated FlutterApi error code documentation', ); patched = _replaceExactlyOnce( - patched, - r''' indent.writeScoped( - 'const gchar* ${responseMethodPrefix}_get_error_message($responseClassName* self) {',''', - r''' indent.writeln( + source: patched, + before: r''' indent.writeScoped( + 'const gchar* ${responseMethodPrefix}_get_error_message($responseClassName* self) {',''', + after: r''' indent.writeln( '/** Purpose: Read the message from a generated FlutterApi error. @param self is an error response. @returns A borrowed error message. @throws Nothing; self must contain an error. */'); indent.writeScoped( - 'const gchar* ${responseMethodPrefix}_get_error_message($responseClassName* self) {',''', - 'generated FlutterApi error message documentation', + 'const gchar* ${responseMethodPrefix}_get_error_message($responseClassName* self) {',''', + description: 'generated FlutterApi error message documentation', ); return _replaceExactlyOnce( - patched, - r''' indent.writeScoped( - 'FlValue* ${responseMethodPrefix}_get_error_details($responseClassName* self) {',''', - r''' indent.writeln( + source: patched, + before: r''' indent.writeScoped( + 'FlValue* ${responseMethodPrefix}_get_error_details($responseClassName* self) {',''', + after: r''' indent.writeln( '/** Purpose: Read structured details from a generated FlutterApi error. @param self is an error response. @returns Borrowed error details. @throws Nothing; self must contain an error. */'); indent.writeScoped( - 'FlValue* ${responseMethodPrefix}_get_error_details($responseClassName* self) {',''', - 'generated FlutterApi error details documentation', + 'FlValue* ${responseMethodPrefix}_get_error_details($responseClassName* self) {',''', + description: 'generated FlutterApi error details documentation', ); } @@ -462,10 +466,10 @@ String _patchFlutterAccessorDocumentation(String source) { /// @throws StateError when the pinned generator source has drifted. String _patchFlutterReturnDocumentation(String source) { return _replaceExactlyOnce( - source, - r''' indent.writeScoped( - '$returnType ${responseMethodPrefix}_get_return_value($responseClassName* self${_isNumericListType(method.returnType) ? ', size_t* return_value_length' : ''}) {',''', - r''' indent.writeln('/**'); + source: source, + before: r''' indent.writeScoped( + '$returnType ${responseMethodPrefix}_get_return_value($responseClassName* self${_isNumericListType(method.returnType) ? ', size_t* return_value_length' : ''}) {',''', + after: r''' indent.writeln('/**'); indent.writeln( ' * Purpose: Read the successful value from a generated FlutterApi response.'); indent.writeln(' * @param self is a successful response.'); @@ -478,8 +482,8 @@ String _patchFlutterReturnDocumentation(String source) { ' * @throws Nothing; self must contain a successful response.'); indent.writeln(' */'); indent.writeScoped( - '$returnType ${responseMethodPrefix}_get_return_value($responseClassName* self${_isNumericListType(method.returnType) ? ', size_t* return_value_length' : ''}) {',''', - 'generated FlutterApi return value documentation', + '$returnType ${responseMethodPrefix}_get_return_value($responseClassName* self${_isNumericListType(method.returnType) ? ', size_t* return_value_length' : ''}) {',''', + description: 'generated FlutterApi return value documentation', ); } @@ -490,12 +494,10 @@ String _patchFlutterReturnDocumentation(String source) { /// @throws StateError when the pinned generator source has drifted. String _patchFlutterMethodDocumentation(String source) { final patched = _replaceExactlyOnce( - source, - r''' indent.newln(); - indent.writeScoped( - "void ${methodPrefix}_$methodName(${asyncArgs.join(', ')}) {", '}', - () {''', - r''' indent.newln(); + source: source, + before: r''' indent.newln(); + indent.writeScoped("void ${methodPrefix}_$methodName(${asyncArgs.join(', ')}) {", '}', () {''', + after: r''' indent.newln(); indent.writeln('/**'); indent.writeln( ' * Purpose: Send one generated ${api.name}.${method.name} call to Flutter.'); @@ -514,24 +516,77 @@ String _patchFlutterMethodDocumentation(String source) { indent.writeln( ' * @throws Nothing; transport errors complete callback.'); indent.writeln(' */'); - indent.writeScoped( - "void ${methodPrefix}_$methodName(${asyncArgs.join(', ')}) {", '}', - () {''', - 'generated FlutterApi send documentation', + indent.writeScoped("void ${methodPrefix}_$methodName(${asyncArgs.join(', ')}) {", '}', () {''', + description: 'generated FlutterApi send documentation', ); return _replaceExactlyOnce( - patched, - r''' indent.newln(); + source: patched, + before: r''' indent.newln(); indent.writeScoped( - "$responseClassName* ${methodPrefix}_${methodName}_finish(${finishArgs.join(', ')}) {", - '}', () {''', - r''' indent.newln(); + "$responseClassName* ${methodPrefix}_${methodName}_finish(${finishArgs.join(', ')}) {", + '}', + () {''', + after: r''' indent.newln(); indent.writeln( '/** Purpose: Finish one generated ${api.name}.${method.name} call. @param self owns the FlutterApi transport. @param result is the completed forwarding task. @param error receives transport or codec failure. @returns A newly owned response or null. @throws Nothing. */'); indent.writeScoped( - "$responseClassName* ${methodPrefix}_${methodName}_finish(${finishArgs.join(', ')}) {", - '}', () {''', - 'generated FlutterApi finish documentation', + "$responseClassName* ${methodPrefix}_${methodName}_finish(${finishArgs.join(', ')}) {", + '}', + () {''', + description: 'generated FlutterApi finish documentation', + ); +} + +/// Purpose: Document the value equality, hashing, and description helpers +/// that Pigeon emits ahead of the generated codec. +/// +/// @param source is the pinned GObject generator source. +/// @returns Source whose value helper templates emit API documentation. +/// @throws StateError when the pinned generator source has drifted. +String _patchValueHelperDocumentation(String source) { + var patched = _replaceExactlyOnce( + source: source, + before: r''' indent.writeScoped('static guint G_GNUC_UNUSED flpigeon_hash_double(double v) {', '}', () {''', + after: r''' indent.writeln( + '/** Purpose: Hash one double so equal values share a hash. @param v is the value to hash. @returns The hash of v. @throws Nothing. */'); + indent.writeScoped('static guint G_GNUC_UNUSED flpigeon_hash_double(double v) {', '}', () {''', + description: 'generated double hash documentation', + ); + patched = _replaceExactlyOnce( + source: patched, + before: r''' indent.writeScoped( + 'static gboolean G_GNUC_UNUSED flpigeon_equals_double(double a, double b) {',''', + after: r''' indent.writeln( + '/** Purpose: Compare two doubles, treating NaN as equal to NaN. @param a is the first value. @param b is the second value. @returns TRUE when the values are equal. @throws Nothing. */'); + indent.writeScoped( + 'static gboolean G_GNUC_UNUSED flpigeon_equals_double(double a, double b) {',''', + description: 'generated double equality documentation', + ); + patched = _replaceExactlyOnce( + source: patched, + before: r''' indent.writeScoped( + 'static gboolean G_GNUC_UNUSED flpigeon_deep_equals(FlValue* a, FlValue* b) {',''', + after: r''' indent.writeln( + '/** Purpose: Compare two channel values structurally. @param a is the first value. @param b is the second value. @returns TRUE when both hold equal content. @throws Nothing. */'); + indent.writeScoped( + 'static gboolean G_GNUC_UNUSED flpigeon_deep_equals(FlValue* a, FlValue* b) {',''', + description: 'generated deep equality documentation', + ); + patched = _replaceExactlyOnce( + source: patched, + before: r''' indent.writeScoped('static guint G_GNUC_UNUSED flpigeon_deep_hash(FlValue* value) {', '}', () {''', + after: r''' indent.writeln( + '/** Purpose: Hash one channel value structurally. @param value is the value to hash. @returns A hash consistent with structural equality. @throws Nothing. */'); + indent.writeScoped('static guint G_GNUC_UNUSED flpigeon_deep_hash(FlValue* value) {', '}', () {''', + description: 'generated deep hash documentation', + ); + return _replaceExactlyOnce( + source: patched, + before: 'static gchar* G_GNUC_UNUSED flpigeon_to_string(FlValue* value) {', + after: + '/** Purpose: Describe one channel value as text. @param value is the value to describe. @returns A newly allocated string the caller frees. @throws Nothing. */\n' + 'static gchar* G_GNUC_UNUSED flpigeon_to_string(FlValue* value) {', + description: 'generated value description documentation', ); } @@ -553,6 +608,7 @@ Future _patchGenerator(File generatorFile) async { source = _patchFlutterAccessorDocumentation(source); source = _patchFlutterReturnDocumentation(source); source = _patchFlutterMethodDocumentation(source); + source = _patchValueHelperDocumentation(source); await generatorFile.writeAsString(source); } @@ -563,7 +619,7 @@ Future _patchGenerator(File generatorFile) async { /// @param patchedRoot is the isolated Pigeon package root. /// @param temporaryRoot owns the rewritten package_config.json. /// @returns The rewritten package-config file. -/// @throws StateError when Pigeon is absent or not pinned to 22.7.4. +/// @throws StateError when Pigeon is absent or not pinned to the expected version. Future _createPatchedPackageConfig( File packageConfig, Directory patchedRoot, @@ -587,10 +643,13 @@ Future _createPatchedPackageConfig( final resolvedRoot = Directory.fromUri( packageConfig.uri.resolve(pigeon['rootUri']! as String), ); - final pubspec = - await File('${resolvedRoot.path}/pubspec.yaml').readAsString(); - if (!RegExp(r'^version:\s*22\.7\.4(?:\s|$)', multiLine: true) - .hasMatch(pubspec)) { + final pubspec = await File('${resolvedRoot.path}/pubspec.yaml') + .readAsString(); + final pinned = RegExp( + '^version:\\s*${RegExp.escape(_pigeonVersion)}(?:\\s|\$)', + multiLine: true, + ); + if (!pinned.hasMatch(pubspec)) { throw StateError( 'Expected Pigeon $_pigeonVersion at ${resolvedRoot.path}.', ); @@ -598,11 +657,12 @@ Future _createPatchedPackageConfig( await _copyDirectory(resolvedRoot, patchedRoot); await _patchGenerator( - File('${patchedRoot.path}/lib/gobject_generator.dart'), + File('${patchedRoot.path}/lib/src/gobject/gobject_generator.dart'), ); for (final package in packages) { - package['rootUri'] = - packageConfig.uri.resolve(package['rootUri']! as String).toString(); + package['rootUri'] = packageConfig.uri + .resolve(package['rootUri']! as String) + .toString(); } pigeon['rootUri'] = patchedRoot.uri.toString(); final patchedConfig = File('${temporaryRoot.path}/package_config.json'); @@ -638,9 +698,7 @@ Directory _parseOutputRoot(List arguments, Directory packageRoot) { Future _formatDartOutput(Directory outputRoot) async { final output = '${outputRoot.path}/lib/src/generated/native_query.g.dart'; final file = File(output); - final formatter = DartFormatter( - languageVersion: DartFormatter.latestShortStyleLanguageVersion, - ); + final formatter = DartFormatter(languageVersion: _dartLanguageVersion); await file.writeAsString( formatter.format(await file.readAsString(), uri: file.uri), ); @@ -666,8 +724,9 @@ Future main(List arguments) async { } await outputRoot.create(recursive: true); - final temporaryRoot = - await Directory.systemTemp.createTemp('simple_query_pigeon_'); + final temporaryRoot = await Directory.systemTemp.createTemp( + 'simple_query_pigeon_', + ); try { final patchedRoot = Directory( '${temporaryRoot.path}/pigeon-$_pigeonVersion', diff --git a/packages/simple_query_linux/tool/run_native_tests.sh b/packages/simple_query_linux/tool/run_native_tests.sh index 6695c20..5d7ce02 100755 --- a/packages/simple_query_linux/tool/run_native_tests.sh +++ b/packages/simple_query_linux/tool/run_native_tests.sh @@ -63,6 +63,13 @@ common_flags=( -Wl,-rpath,"${engine_root}" -Wl,--wrap=g_cancellable_new -Wl,--wrap=g_dbus_connection_call_sync + # Flutter 3.50's engine library exports LLVM libunwind's _Unwind_* symbols. + # Listed first, they would replace libgcc's unwinder for libstdc++ + # exceptions, which then find no handler and terminate (UNFY-418). Load + # libgcc_s ahead of the engine so the plugin's exceptions unwind normally. + -Wl,--push-state,--no-as-needed + -lgcc_s + -Wl,--pop-state -lflutter_linux_gtk "${gtk_flags[@]}" ) diff --git a/packages/simple_query_macos/CHANGELOG.md b/packages/simple_query_macos/CHANGELOG.md index 3338472..31c417a 100644 --- a/packages/simple_query_macos/CHANGELOG.md +++ b/packages/simple_query_macos/CHANGELOG.md @@ -1,3 +1,8 @@ +## Unreleased + +- **Breaking:** Requires Flutter 3.47.7 / Dart 3.13. Release as a breaking version (the next 0.x minor) (UNFY-412). +- Regenerates the platform channel code with Pigeon 30 (UNFY-412). + ## 0.3.0 - chore(release): reset versions to align with pub.dev (smallest iteration) diff --git a/packages/simple_query_macos/lib/simple_query_macos.dart b/packages/simple_query_macos/lib/simple_query_macos.dart index 95acf1b..334c34c 100644 --- a/packages/simple_query_macos/lib/simple_query_macos.dart +++ b/packages/simple_query_macos/lib/simple_query_macos.dart @@ -38,7 +38,10 @@ class SimpleQueryMacos extends DarwinQueryPlatform } @override - void onObserveEvent(String observerId, Map event) { + Future onObserveEvent( + String observerId, + Map event, + ) async { onObserveEventFromNative(observerId, event); } diff --git a/packages/simple_query_macos/lib/src/generated/native_query.g.dart b/packages/simple_query_macos/lib/src/generated/native_query.g.dart index ae08d97..abed6e9 100644 --- a/packages/simple_query_macos/lib/src/generated/native_query.g.dart +++ b/packages/simple_query_macos/lib/src/generated/native_query.g.dart @@ -1,22 +1,44 @@ -// Autogenerated from Pigeon (v22.7.4), do not edit directly. +// Autogenerated from Pigeon (v30.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers +// ignore_for_file: unused_import, unused_shown_name +// ignore_for_file: type=lint import 'dart:async'; -import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; +import 'dart:typed_data' show Float64List, Int32List, Int64List; -import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; -PlatformException _createConnectionError(String channelName) { - return PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel: "$channelName".', - ); +Object? _extractReplyValueOrThrow( + List? replyList, + String channelName, { + required bool isNullValid, +}) { + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else if (!isNullValid && (replyList.isNotEmpty && replyList[0] == null)) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } + return replyList.firstOrNull; } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({ + Object? result, + PlatformException? error, + bool empty = false, +}) { if (empty) { return []; } @@ -48,316 +70,247 @@ class _PigeonCodec extends StandardMessageCodec { } class NativeQueryHostApi { - /// Constructor for [NativeQueryHostApi]. The [binaryMessenger] named argument is - /// available for dependency injection. If it is left null, the default + /// Constructor for [NativeQueryHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - NativeQueryHostApi( - {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? pigeonVar_binaryMessenger; + NativeQueryHostApi({ + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); final String pigeonVar_messageChannelSuffix; Future> getCapabilities() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_macos.NativeQueryHostApi.getCapabilities$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send(null) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } Future> query(Map request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_macos.NativeQueryHostApi.query$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } Future> mutate(Map request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_macos.NativeQueryHostApi.mutate$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } Future> batch(Map request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_macos.NativeQueryHostApi.batch$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } Future observeStart(Map request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_macos.NativeQueryHostApi.observeStart$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as String; } Future observeStop(String observerId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_macos.NativeQueryHostApi.observeStop$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([observerId]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [observerId], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } Future> openBinary( - Map request) async { - final String pigeonVar_channelName = + Map request, + ) async { + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_macos.NativeQueryHostApi.openBinary$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } Future closeBinary(String handleId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_macos.NativeQueryHostApi.closeBinary$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([handleId]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [handleId], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } Future?> callExtension( - String namespace, String method, Map? args) async { - final String pigeonVar_channelName = + String namespace, + String method, + Map? args, + ) async { + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_macos.NativeQueryHostApi.callExtension$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([namespace, method, args]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as Map?) - ?.cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [namespace, method, args], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return (pigeonVar_replyValue as Map?) + ?.cast(); } } abstract class NativeQueryFlutterApi { static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - void onObserveEvent(String observerId, Map event); + Future onObserveEvent(String observerId, Map event); static void setUp( NativeQueryFlutterApi? api, { BinaryMessenger? binaryMessenger, String messageChannelSuffix = '', }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.simple_query_macos.NativeQueryFlutterApi.onObserveEvent$messageChannelSuffix', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); + final pigeonVar_channel = BasicMessageChannel( + 'dev.flutter.pigeon.simple_query_macos.NativeQueryFlutterApi.onObserveEvent$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger, + ); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.simple_query_macos.NativeQueryFlutterApi.onObserveEvent was null.'); - final List args = (message as List?)!; - final String? arg_observerId = (args[0] as String?); - assert(arg_observerId != null, - 'Argument for dev.flutter.pigeon.simple_query_macos.NativeQueryFlutterApi.onObserveEvent was null, expected non-null String.'); - final Map? arg_event = - (args[1] as Map?)?.cast(); - assert(arg_event != null, - 'Argument for dev.flutter.pigeon.simple_query_macos.NativeQueryFlutterApi.onObserveEvent was null, expected non-null Map.'); + final List args = message! as List; + final String arg_observerId = args[0]! as String; + final Map arg_event = + (args[1]! as Map).cast(); try { - api.onObserveEvent(arg_observerId!, arg_event!); + await api.onObserveEvent(arg_observerId, arg_event); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); } catch (e) { return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + error: PlatformException(code: 'error', message: e.toString()), + ); } }); } diff --git a/packages/simple_query_macos/macos/simple_query_macos/Sources/simple_query_macos/NativeQuery.g.swift b/packages/simple_query_macos/macos/simple_query_macos/Sources/simple_query_macos/NativeQuery.g.swift index eec8da8..a6951b3 100644 --- a/packages/simple_query_macos/macos/simple_query_macos/Sources/simple_query_macos/NativeQuery.g.swift +++ b/packages/simple_query_macos/macos/simple_query_macos/Sources/simple_query_macos/NativeQuery.g.swift @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v22.7.4), do not edit directly. +// Autogenerated from Pigeon (v30.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -15,9 +15,9 @@ import Foundation final class NativeQueryPigeonError: Error { let code: String let message: String? - let details: Any? + let details: Sendable? - init(code: String, message: String?, details: Any?) { + init(code: String, message: String?, details: Sendable?) { self.code = code self.message = message self.details = details @@ -25,8 +25,8 @@ final class NativeQueryPigeonError: Error { var localizedDescription: String { return - "NativeQueryPigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" - } + "NativeQueryPigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? ""))" + } } private func wrapResult(_ result: Any?) -> [Any?] { @@ -50,7 +50,7 @@ private func wrapError(_ error: Any) -> [Any?] { } return [ "\(error)", - "\(type(of: error))", + "\(Swift.type(of: error))", "Stacktrace: \(Thread.callStackSymbols)", ] } @@ -59,8 +59,18 @@ private func createConnectionError(withChannelName channelName: String) -> Nativ return NativeQueryPigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") } -private func isNullish(_ value: Any?) -> Bool { - return value is NSNull || value == nil +enum NativeQueryPigeonInternal { + static func isNullish(_ value: Any?) -> Bool { + guard let innerValue = value else { + return true + } + + if case Optional.some(Optional.none) = value { + return true + } + + return innerValue is NSNull + } } private func nilOrValue(_ value: Any?) -> T? { @@ -68,6 +78,7 @@ private func nilOrValue(_ value: Any?) -> T? { return value as! T? } + private class NativeQueryPigeonCodecReader: FlutterStandardReader { } @@ -244,6 +255,7 @@ class NativeQueryHostApiSetup { } } } + /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol NativeQueryFlutterApiProtocol { func onObserveEvent(observerId observerIdArg: String, event eventArg: [String?: Any?], completion: @escaping (Result) -> Void) @@ -272,7 +284,7 @@ class NativeQueryFlutterApi: NativeQueryFlutterApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(NativeQueryPigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } diff --git a/packages/simple_query_macos/pigeon.dart b/packages/simple_query_macos/pigeon.dart index 0b15f62..b7f9406 100644 --- a/packages/simple_query_macos/pigeon.dart +++ b/packages/simple_query_macos/pigeon.dart @@ -29,5 +29,6 @@ abstract class NativeQueryHostApi { @FlutterApi() abstract class NativeQueryFlutterApi { + @asyncCallback void onObserveEvent(String observerId, Map event); } diff --git a/packages/simple_query_macos/pubspec.lock b/packages/simple_query_macos/pubspec.lock new file mode 100644 index 0000000..8f3b567 --- /dev/null +++ b/packages/simple_query_macos/pubspec.lock @@ -0,0 +1,387 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "1c5591cc6f252d5f440d96ab87c03e43504be552a3fa49d7cb7563f04c51fb0a" + url: "https://pub.dev" + source: hosted + version: "111.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "6c39bd5486a310e56217bed7cb1691377959f31be4227e41750107db7e6dd55c" + url: "https://pub.dev" + source: hosted + version: "14.7.0" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "44922ecebd8e3d0cef743dadd3b54df4e87e2a4c52a29465a1872aa9e192caa8" + url: "https://pub.dev" + source: hosted + version: "5.1.2" + built_value: + dependency: transitive + description: + name: built_value + sha256: f87ea98192116f7093cb214551ce1929caae0681fdba282b3d8b4462adee7bb7 + url: "https://pub.dev" + source: hosted + version: "8.13.0" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + clock: + dependency: transitive + description: + name: clock + sha256: e51d50bca3217c9a9fa2b41a30e4a38971133f5f9ec7a3d57bae095007f1d28e + url: "https://pub.dev" + source: hosted + version: "1.1.3" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "811709c1badd02fc054039a13f66e0db1961865f9a314175f68c3eaeebec786f" + url: "https://pub.dev" + source: hosted + version: "4.13.0" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + crypto: + dependency: transitive + description: + name: crypto + sha256: e3626ae6270383c9e3a549f34c9e4cd26c09ae6a9adaab2bf4737a00340efdc4 + url: "https://pub.dev" + source: hosted + version: "3.0.8" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: a0e4f65339b31eb6a9e6a12e14b4682a48d46fbc54a82f4a702396fbdbac63a7 + url: "https://pub.dev" + source: hosted + version: "3.1.14" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: "218aeb56050c714f62a3182775320dfa04602b55074873e24e31bbd39bda96fb" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + listen: + dependency: transitive + description: + name: listen + sha256: "47501a08016a43fcad79252439d723f50f14f88fa7bfd8a177e0a417e5c9e1f2" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd" + url: "https://pub.dev" + source: hosted + version: "0.12.20" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + meta: + dependency: "direct main" + description: + name: meta + sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" + url: "https://pub.dev" + source: hosted + version: "1.19.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: ffcf4cf3d6c0b74ac43708d9f56625506e8a68aa935abe9d267a7330f320eb5d + url: "https://pub.dev" + source: hosted + version: "3.0.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + pigeon: + dependency: "direct dev" + description: + name: pigeon + sha256: "5c2ac8dd19571590eaf4c178bf4a093b5646dc376d2d2619943ce2aa0aa860d0" + url: "https://pub.dev" + source: hosted + version: "30.0.4" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "261236774e8b1d69cfc6b9eabbc96c40f25e7a2d6b171f3385d4f65d5734fb24" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + simple_query_platform_interface: + dependency: "direct main" + description: + path: "../simple_query_platform_interface" + relative: true + source: path + version: "0.2.2" + simple_query_shared: + dependency: "direct main" + description: + path: "../simple_query_shared" + relative: true + source: path + version: "0.3.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490" + url: "https://pub.dev" + source: hosted + version: "1.12.2" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "0a10344e901e5b2e63819567951cb6a06673ed6b84f40462188ff5a0c41f371f" + url: "https://pub.dev" + source: hosted + version: "0.7.14" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: fa49e1674cb84acb900141714e6c6e1f9ae099827c24d141430ff6819db4e1bc + url: "https://pub.dev" + source: hosted + version: "2.4.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "89b11d62e1040ee681af3b4f1c97a803ecbf010c6e8b9c5896ee5b08c3bf7b78" + url: "https://pub.dev" + source: hosted + version: "15.4.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: f67cdd8e07d3c6329146aaef1ba043542b3134c12489f553ca9a7435d1068aea + url: "https://pub.dev" + source: hosted + version: "3.1.4" +sdks: + dart: ">=3.13.0 <4.0.0" + flutter: ">=3.47.7" diff --git a/packages/simple_query_macos/pubspec.yaml b/packages/simple_query_macos/pubspec.yaml index a382f21..9f7f5a3 100644 --- a/packages/simple_query_macos/pubspec.yaml +++ b/packages/simple_query_macos/pubspec.yaml @@ -13,20 +13,21 @@ topics: - files environment: - sdk: ^3.6.0 - flutter: '>=3.44.0' + sdk: ^3.13.0 + flutter: '>=3.47.7' dependencies: flutter: sdk: flutter + meta: ^1.17.0 simple_query_platform_interface: ^0.2.0 simple_query_shared: ^0.3.0 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^5.0.0 - pigeon: 22.7.4 + flutter_lints: 6.0.0 + pigeon: 30.0.4 flutter: plugin: diff --git a/packages/simple_query_platform_interface/CHANGELOG.md b/packages/simple_query_platform_interface/CHANGELOG.md index 2e541d3..c2b0b94 100644 --- a/packages/simple_query_platform_interface/CHANGELOG.md +++ b/packages/simple_query_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## Unreleased + +- **Breaking:** Requires Flutter 3.47.7 / Dart 3.13. Release as a breaking version (the next 0.x minor) (UNFY-412). + ## 0.2.2 - chore(release): reset versions to align with pub.dev (smallest iteration) diff --git a/packages/simple_query_platform_interface/lib/src/testing.dart b/packages/simple_query_platform_interface/lib/src/testing.dart index 5e7e723..9f4da0e 100644 --- a/packages/simple_query_platform_interface/lib/src/testing.dart +++ b/packages/simple_query_platform_interface/lib/src/testing.dart @@ -18,7 +18,7 @@ class FakeSimpleQueryPlatform extends SimpleQueryPlatform { BatchResult? batchResult, BinaryContentHandle? binaryContentHandle, Stream? observeStream, - Map? extensionResult, + this._extensionResult, }) : _capabilities = capabilities ?? _defaultCapabilities(), _queryResult = queryResult ?? const QueryResult(records: []), _mutationResult = @@ -26,8 +26,7 @@ class FakeSimpleQueryPlatform extends SimpleQueryPlatform { _batchResult = batchResult ?? const BatchResult(results: []), _binaryContentHandle = binaryContentHandle ?? const BinaryContentHandle(handleId: 'h', localPath: '/tmp/h'), - _observeStream = observeStream ?? const Stream.empty(), - _extensionResult = extensionResult; + _observeStream = observeStream ?? const Stream.empty(); final CapabilitySnapshot _capabilities; final QueryResult _queryResult; diff --git a/packages/simple_query_platform_interface/pubspec.lock b/packages/simple_query_platform_interface/pubspec.lock new file mode 100644 index 0000000..c1c8730 --- /dev/null +++ b/packages/simple_query_platform_interface/pubspec.lock @@ -0,0 +1,221 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + clock: + dependency: transitive + description: + name: clock + sha256: e51d50bca3217c9a9fa2b41a30e4a38971133f5f9ec7a3d57bae095007f1d28e + url: "https://pub.dev" + source: hosted + version: "1.1.3" + collection: + dependency: "direct main" + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + listen: + dependency: transitive + description: + name: listen + sha256: "47501a08016a43fcad79252439d723f50f14f88fa7bfd8a177e0a417e5c9e1f2" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd" + url: "https://pub.dev" + source: hosted + version: "0.12.20" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + meta: + dependency: transitive + description: + name: meta + sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" + url: "https://pub.dev" + source: hosted + version: "1.19.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + plugin_platform_interface: + dependency: "direct main" + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490" + url: "https://pub.dev" + source: hosted + version: "1.12.2" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "0a10344e901e5b2e63819567951cb6a06673ed6b84f40462188ff5a0c41f371f" + url: "https://pub.dev" + source: hosted + version: "0.7.14" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: fa49e1674cb84acb900141714e6c6e1f9ae099827c24d141430ff6819db4e1bc + url: "https://pub.dev" + source: hosted + version: "2.4.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "89b11d62e1040ee681af3b4f1c97a803ecbf010c6e8b9c5896ee5b08c3bf7b78" + url: "https://pub.dev" + source: hosted + version: "15.4.0" +sdks: + dart: ">=3.13.0 <4.0.0" + flutter: ">=3.47.7" diff --git a/packages/simple_query_platform_interface/pubspec.yaml b/packages/simple_query_platform_interface/pubspec.yaml index f44ee23..14adde0 100644 --- a/packages/simple_query_platform_interface/pubspec.yaml +++ b/packages/simple_query_platform_interface/pubspec.yaml @@ -13,8 +13,8 @@ topics: - files environment: - sdk: ^3.6.0 - flutter: '>=3.24.0' + sdk: ^3.13.0 + flutter: '>=3.47.7' dependencies: collection: ^1.18.0 @@ -25,4 +25,4 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^5.0.0 + flutter_lints: 6.0.0 diff --git a/packages/simple_query_shared/CHANGELOG.md b/packages/simple_query_shared/CHANGELOG.md index 9383dbe..851676c 100644 --- a/packages/simple_query_shared/CHANGELOG.md +++ b/packages/simple_query_shared/CHANGELOG.md @@ -1,3 +1,7 @@ +## Unreleased + +- **Breaking:** Requires Flutter 3.47.7 / Dart 3.13. Release as a breaking version (the next 0.x minor) (UNFY-412). + ## 0.3.0 - fix(UNFY-265): release cancelled pending observer starts diff --git a/packages/simple_query_shared/lib/src/darwin_query_platform.dart b/packages/simple_query_shared/lib/src/darwin_query_platform.dart index 036c5aa..09af76a 100644 --- a/packages/simple_query_shared/lib/src/darwin_query_platform.dart +++ b/packages/simple_query_shared/lib/src/darwin_query_platform.dart @@ -272,7 +272,7 @@ abstract class DarwinQueryPlatform extends BaseNonAndroidSimpleQueryPlatform { QueryRequest( domain: QueryDomain.media, platformData: { - if (rootPathArg != null) 'rootPath': rootPathArg, + 'rootPath': ?rootPathArg, }, ), ); diff --git a/packages/simple_query_shared/lib/src/filesystem_fallback.dart b/packages/simple_query_shared/lib/src/filesystem_fallback.dart index d7c35b2..0fd56e9 100644 --- a/packages/simple_query_shared/lib/src/filesystem_fallback.dart +++ b/packages/simple_query_shared/lib/src/filesystem_fallback.dart @@ -760,7 +760,7 @@ class LocalFileSystemFallback { details: { if (error.path != null) 'path': error.path!, if (error.osError?.message != null) 'osError': error.osError!.message, - if (errno != null) 'errno': errno, + 'errno': ?errno, }, ); } diff --git a/packages/simple_query_shared/pubspec.lock b/packages/simple_query_shared/pubspec.lock new file mode 100644 index 0000000..562cdd0 --- /dev/null +++ b/packages/simple_query_shared/pubspec.lock @@ -0,0 +1,228 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + clock: + dependency: transitive + description: + name: clock + sha256: e51d50bca3217c9a9fa2b41a30e4a38971133f5f9ec7a3d57bae095007f1d28e + url: "https://pub.dev" + source: hosted + version: "1.1.3" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + listen: + dependency: transitive + description: + name: listen + sha256: "47501a08016a43fcad79252439d723f50f14f88fa7bfd8a177e0a417e5c9e1f2" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd" + url: "https://pub.dev" + source: hosted + version: "0.12.20" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + meta: + dependency: transitive + description: + name: meta + sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" + url: "https://pub.dev" + source: hosted + version: "1.19.0" + path: + dependency: "direct main" + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + simple_query_platform_interface: + dependency: "direct main" + description: + path: "../simple_query_platform_interface" + relative: true + source: path + version: "0.2.2" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490" + url: "https://pub.dev" + source: hosted + version: "1.12.2" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "0a10344e901e5b2e63819567951cb6a06673ed6b84f40462188ff5a0c41f371f" + url: "https://pub.dev" + source: hosted + version: "0.7.14" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: fa49e1674cb84acb900141714e6c6e1f9ae099827c24d141430ff6819db4e1bc + url: "https://pub.dev" + source: hosted + version: "2.4.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "89b11d62e1040ee681af3b4f1c97a803ecbf010c6e8b9c5896ee5b08c3bf7b78" + url: "https://pub.dev" + source: hosted + version: "15.4.0" +sdks: + dart: ">=3.13.0 <4.0.0" + flutter: ">=3.47.7" diff --git a/packages/simple_query_shared/pubspec.yaml b/packages/simple_query_shared/pubspec.yaml index e689f24..29f951c 100644 --- a/packages/simple_query_shared/pubspec.yaml +++ b/packages/simple_query_shared/pubspec.yaml @@ -13,8 +13,8 @@ topics: - files environment: - sdk: ^3.6.0 - flutter: '>=3.24.0' + sdk: ^3.13.0 + flutter: '>=3.47.7' dependencies: flutter: @@ -25,4 +25,4 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^5.0.0 + flutter_lints: 6.0.0 diff --git a/packages/simple_query_shared/test/non_android_native_bridge_test.dart b/packages/simple_query_shared/test/non_android_native_bridge_test.dart index d56ee52..c45b3ea 100644 --- a/packages/simple_query_shared/test/non_android_native_bridge_test.dart +++ b/packages/simple_query_shared/test/non_android_native_bridge_test.dart @@ -37,7 +37,7 @@ void main() { 'localPath': '/tmp/h', }, closeBinary: (_) async {}, - callExtension: (_, __, ___) async => null, + callExtension: (_, _, _) async => null, nativeDomainSupported: (_) => true, ); @@ -113,7 +113,7 @@ void main() { observeStop: (_) async {}, openBinary: (_) async => {}, closeBinary: (_) async {}, - callExtension: (_, __, ___) async => null, + callExtension: (_, _, _) async => null, nativeDomainSupported: (_) => true, ); diff --git a/packages/simple_query_shared/test/observer_start_lifecycle_test.dart b/packages/simple_query_shared/test/observer_start_lifecycle_test.dart index 9b6ccfc..672abfe 100644 --- a/packages/simple_query_shared/test/observer_start_lifecycle_test.dart +++ b/packages/simple_query_shared/test/observer_start_lifecycle_test.dart @@ -26,7 +26,7 @@ NonAndroidNativeBridge _bridge({ observeStop: stop, openBinary: (_) async => {}, closeBinary: (_) async {}, - callExtension: (_, __, ___) async => null, + callExtension: (_, _, _) async => null, nativeDomainSupported: (_) => true, ); diff --git a/packages/simple_query_windows/CHANGELOG.md b/packages/simple_query_windows/CHANGELOG.md index 1a0e08c..ec8d4fa 100644 --- a/packages/simple_query_windows/CHANGELOG.md +++ b/packages/simple_query_windows/CHANGELOG.md @@ -1,3 +1,8 @@ +## Unreleased + +- **Breaking:** Requires Flutter 3.47.7 / Dart 3.13. Release as a breaking version (the next 0.x minor) (UNFY-412). +- Regenerates the platform channel code with Pigeon 30 (UNFY-412). + ## 0.3.0 - chore(release): reset versions to align with pub.dev (smallest iteration) diff --git a/packages/simple_query_windows/lib/src/generated/native_query.g.dart b/packages/simple_query_windows/lib/src/generated/native_query.g.dart index 34c7f1d..0f7f5e5 100644 --- a/packages/simple_query_windows/lib/src/generated/native_query.g.dart +++ b/packages/simple_query_windows/lib/src/generated/native_query.g.dart @@ -1,22 +1,44 @@ -// Autogenerated from Pigeon (v22.7.4), do not edit directly. +// Autogenerated from Pigeon (v30.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers +// ignore_for_file: unused_import, unused_shown_name +// ignore_for_file: type=lint import 'dart:async'; -import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; +import 'dart:typed_data' show Float64List, Int32List, Int64List; -import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; -PlatformException _createConnectionError(String channelName) { - return PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel: "$channelName".', - ); +Object? _extractReplyValueOrThrow( + List? replyList, + String channelName, { + required bool isNullValid, +}) { + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else if (!isNullValid && (replyList.isNotEmpty && replyList[0] == null)) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } + return replyList.firstOrNull; } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({ + Object? result, + PlatformException? error, + bool empty = false, +}) { if (empty) { return []; } @@ -48,246 +70,183 @@ class _PigeonCodec extends StandardMessageCodec { } class NativeQueryHostApi { - /// Constructor for [NativeQueryHostApi]. The [binaryMessenger] named argument is - /// available for dependency injection. If it is left null, the default + /// Constructor for [NativeQueryHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - NativeQueryHostApi( - {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? pigeonVar_binaryMessenger; + NativeQueryHostApi({ + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); final String pigeonVar_messageChannelSuffix; Future> getCapabilities() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.getCapabilities$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send(null) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } Future> query(Map request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.query$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } Future> mutate(Map request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.mutate$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } Future> batch(Map request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.batch$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } Future observeStart(Map request) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.observeStart$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as String; } Future observeStop(String observerId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.observeStop$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([observerId]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [observerId], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } Future> openBinary( - Map request) async { - final String pigeonVar_channelName = + Map request, + ) async { + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.openBinary$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([request]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Map?)! - .cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [request], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as Map) + .cast(); } Future closeBinary(String handleId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.closeBinary$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([handleId]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [handleId], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Purpose: Calls a namespaced Windows-only extension. @@ -295,30 +254,29 @@ class NativeQueryHostApi { /// @param extensionNamespace selects the registered Windows extension namespace. /// It is not named `namespace`, a C++ keyword, and carries no trailing /// underscore, which Pigeon would turn into a reserved C++ identifier. - Future?> callExtension(String extensionNamespace, - String method, Map? args) async { - final String pigeonVar_channelName = + Future?> callExtension( + String extensionNamespace, + String method, + Map? args, + ) async { + final pigeonVar_channelName = 'dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.callExtension$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([extensionNamespace, method, args]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as Map?) - ?.cast(); - } + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [extensionNamespace, method, args], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return (pigeonVar_replyValue as Map?) + ?.cast(); } } @@ -332,37 +290,32 @@ abstract class NativeQueryFlutterApi { BinaryMessenger? binaryMessenger, String messageChannelSuffix = '', }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.simple_query_windows.NativeQueryFlutterApi.onObserveEvent$messageChannelSuffix', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); + final pigeonVar_channel = BasicMessageChannel( + 'dev.flutter.pigeon.simple_query_windows.NativeQueryFlutterApi.onObserveEvent$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger, + ); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.simple_query_windows.NativeQueryFlutterApi.onObserveEvent was null.'); - final List args = (message as List?)!; - final String? arg_observerId = (args[0] as String?); - assert(arg_observerId != null, - 'Argument for dev.flutter.pigeon.simple_query_windows.NativeQueryFlutterApi.onObserveEvent was null, expected non-null String.'); - final Map? arg_event = - (args[1] as Map?)?.cast(); - assert(arg_event != null, - 'Argument for dev.flutter.pigeon.simple_query_windows.NativeQueryFlutterApi.onObserveEvent was null, expected non-null Map.'); + final List args = message! as List; + final String arg_observerId = args[0]! as String; + final Map arg_event = + (args[1]! as Map).cast(); try { - api.onObserveEvent(arg_observerId!, arg_event!); + api.onObserveEvent(arg_observerId, arg_event); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); } catch (e) { return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + error: PlatformException(code: 'error', message: e.toString()), + ); } }); } diff --git a/packages/simple_query_windows/pigeon.dart b/packages/simple_query_windows/pigeon.dart index 4210944..8823f1a 100644 --- a/packages/simple_query_windows/pigeon.dart +++ b/packages/simple_query_windows/pigeon.dart @@ -15,18 +15,18 @@ import 'package:pigeon/pigeon.dart'; abstract class NativeQueryHostApi { // Every call that reads a store or the filesystem is @async, so Windows // runs it off the platform thread and replies when it finishes. - @async + @asyncCallback Map getCapabilities(); - @async + @asyncCallback Map query(Map request); - @async + @asyncCallback Map mutate(Map request); - @async + @asyncCallback Map batch(Map request); - @async + @asyncCallback String observeStart(Map request); void observeStop(String observerId); - @async + @asyncCallback Map openBinary(Map request); void closeBinary(String handleId); /// Purpose: Calls a namespaced Windows-only extension. @@ -34,7 +34,7 @@ abstract class NativeQueryHostApi { /// @param extensionNamespace selects the registered Windows extension namespace. /// It is not named `namespace`, a C++ keyword, and carries no trailing /// underscore, which Pigeon would turn into a reserved C++ identifier. - @async + @asyncCallback Map? callExtension( String extensionNamespace, String method, diff --git a/packages/simple_query_windows/pubspec.lock b/packages/simple_query_windows/pubspec.lock new file mode 100644 index 0000000..8f3b567 --- /dev/null +++ b/packages/simple_query_windows/pubspec.lock @@ -0,0 +1,387 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "1c5591cc6f252d5f440d96ab87c03e43504be552a3fa49d7cb7563f04c51fb0a" + url: "https://pub.dev" + source: hosted + version: "111.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "6c39bd5486a310e56217bed7cb1691377959f31be4227e41750107db7e6dd55c" + url: "https://pub.dev" + source: hosted + version: "14.7.0" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "44922ecebd8e3d0cef743dadd3b54df4e87e2a4c52a29465a1872aa9e192caa8" + url: "https://pub.dev" + source: hosted + version: "5.1.2" + built_value: + dependency: transitive + description: + name: built_value + sha256: f87ea98192116f7093cb214551ce1929caae0681fdba282b3d8b4462adee7bb7 + url: "https://pub.dev" + source: hosted + version: "8.13.0" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + clock: + dependency: transitive + description: + name: clock + sha256: e51d50bca3217c9a9fa2b41a30e4a38971133f5f9ec7a3d57bae095007f1d28e + url: "https://pub.dev" + source: hosted + version: "1.1.3" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "811709c1badd02fc054039a13f66e0db1961865f9a314175f68c3eaeebec786f" + url: "https://pub.dev" + source: hosted + version: "4.13.0" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + crypto: + dependency: transitive + description: + name: crypto + sha256: e3626ae6270383c9e3a549f34c9e4cd26c09ae6a9adaab2bf4737a00340efdc4 + url: "https://pub.dev" + source: hosted + version: "3.0.8" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: a0e4f65339b31eb6a9e6a12e14b4682a48d46fbc54a82f4a702396fbdbac63a7 + url: "https://pub.dev" + source: hosted + version: "3.1.14" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: "218aeb56050c714f62a3182775320dfa04602b55074873e24e31bbd39bda96fb" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + listen: + dependency: transitive + description: + name: listen + sha256: "47501a08016a43fcad79252439d723f50f14f88fa7bfd8a177e0a417e5c9e1f2" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd" + url: "https://pub.dev" + source: hosted + version: "0.12.20" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + meta: + dependency: "direct main" + description: + name: meta + sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" + url: "https://pub.dev" + source: hosted + version: "1.19.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: ffcf4cf3d6c0b74ac43708d9f56625506e8a68aa935abe9d267a7330f320eb5d + url: "https://pub.dev" + source: hosted + version: "3.0.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + pigeon: + dependency: "direct dev" + description: + name: pigeon + sha256: "5c2ac8dd19571590eaf4c178bf4a093b5646dc376d2d2619943ce2aa0aa860d0" + url: "https://pub.dev" + source: hosted + version: "30.0.4" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "261236774e8b1d69cfc6b9eabbc96c40f25e7a2d6b171f3385d4f65d5734fb24" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + simple_query_platform_interface: + dependency: "direct main" + description: + path: "../simple_query_platform_interface" + relative: true + source: path + version: "0.2.2" + simple_query_shared: + dependency: "direct main" + description: + path: "../simple_query_shared" + relative: true + source: path + version: "0.3.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490" + url: "https://pub.dev" + source: hosted + version: "1.12.2" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "0a10344e901e5b2e63819567951cb6a06673ed6b84f40462188ff5a0c41f371f" + url: "https://pub.dev" + source: hosted + version: "0.7.14" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: fa49e1674cb84acb900141714e6c6e1f9ae099827c24d141430ff6819db4e1bc + url: "https://pub.dev" + source: hosted + version: "2.4.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "89b11d62e1040ee681af3b4f1c97a803ecbf010c6e8b9c5896ee5b08c3bf7b78" + url: "https://pub.dev" + source: hosted + version: "15.4.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: f67cdd8e07d3c6329146aaef1ba043542b3134c12489f553ca9a7435d1068aea + url: "https://pub.dev" + source: hosted + version: "3.1.4" +sdks: + dart: ">=3.13.0 <4.0.0" + flutter: ">=3.47.7" diff --git a/packages/simple_query_windows/pubspec.yaml b/packages/simple_query_windows/pubspec.yaml index ff5d9f7..8f68d84 100644 --- a/packages/simple_query_windows/pubspec.yaml +++ b/packages/simple_query_windows/pubspec.yaml @@ -13,20 +13,21 @@ topics: - files environment: - sdk: ^3.6.0 - flutter: '>=3.24.0' + sdk: ^3.13.0 + flutter: '>=3.47.7' dependencies: flutter: sdk: flutter + meta: ^1.17.0 simple_query_platform_interface: ^0.2.0 simple_query_shared: ^0.3.0 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^5.0.0 - pigeon: 22.7.4 + flutter_lints: 6.0.0 + pigeon: 30.0.4 flutter: plugin: diff --git a/packages/simple_query_windows/windows/native_query.g.cpp b/packages/simple_query_windows/windows/native_query.g.cpp index db2f0b3..d69e2fa 100644 --- a/packages/simple_query_windows/windows/native_query.g.cpp +++ b/packages/simple_query_windows/windows/native_query.g.cpp @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v22.7.4), do not edit directly. +// Autogenerated from Pigeon (v30.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon #undef _HAS_EXCEPTIONS @@ -10,16 +10,19 @@ #include #include +#include +#include #include #include +#include #include namespace simple_query_windows { -using flutter::BasicMessageChannel; -using flutter::CustomEncodableValue; -using flutter::EncodableList; -using flutter::EncodableMap; -using flutter::EncodableValue; +using ::flutter::BasicMessageChannel; +using ::flutter::CustomEncodableValue; +using ::flutter::EncodableList; +using ::flutter::EncodableMap; +using ::flutter::EncodableValue; FlutterError CreateConnectionError(const std::string channel_name) { return FlutterError( @@ -28,42 +31,330 @@ FlutterError CreateConnectionError(const std::string channel_name) { EncodableValue("")); } +namespace { +template +bool PigeonInternalDeepEquals(const T& a, const T& b); + +bool PigeonInternalDeepEquals(const double& a, const double& b); + +template +bool PigeonInternalDeepEquals(const std::vector& a, const std::vector& b); + +template +bool PigeonInternalDeepEquals(const std::map& a, const std::map& b); + +template +bool PigeonInternalDeepEquals(const std::optional& a, const std::optional& b); + +template +bool PigeonInternalDeepEquals(const std::unique_ptr& a, const std::unique_ptr& b); + +bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, const ::flutter::EncodableValue& b); + +template +bool PigeonInternalDeepEquals(const T& a, const T& b) { + return a == b; +} + +template +bool PigeonInternalDeepEquals(const std::vector& a, const std::vector& b) { + if (a.size() != b.size()) { + return false; + } + for (size_t i = 0; i < a.size(); ++i) { + if (!PigeonInternalDeepEquals(a[i], b[i])) { + return false; + } + } + return true; +} + +template +bool PigeonInternalDeepEquals(const std::map& a, const std::map& b) { + if (a.size() != b.size()) { + return false; + } + for (const auto& kv : a) { + bool found = false; + for (const auto& b_kv : b) { + if (PigeonInternalDeepEquals(kv.first, b_kv.first)) { + if (PigeonInternalDeepEquals(kv.second, b_kv.second)) { + found = true; + break; + } else { + return false; + } + } + } + if (!found) { + return false; + } + } + return true; +} + +bool PigeonInternalDeepEquals(const double& a, const double& b) { + // Normalize -0.0 to 0.0 and handle NaN equality. + return (a == b) || (std::isnan(a) && std::isnan(b)); +} + +template +bool PigeonInternalDeepEquals(const std::optional& a, const std::optional& b) { + if (!a && !b) { + return true; + } + if (!a || !b) { + return false; + } + return PigeonInternalDeepEquals(*a, *b); +} + +template +bool PigeonInternalDeepEquals(const std::unique_ptr& a, const std::unique_ptr& b) { + if (a.get() == b.get()) { + return true; + } + if (!a || !b) { + return false; + } + return PigeonInternalDeepEquals(*a, *b); +} + +bool PigeonInternalDeepEquals(const ::flutter::EncodableValue& a, const ::flutter::EncodableValue& b) { + if (a.index() != b.index()) { + return false; + } + if (const double* da = std::get_if(&a)) { + return PigeonInternalDeepEquals(*da, std::get(b)); + } else if (const ::flutter::EncodableList* la = std::get_if<::flutter::EncodableList>(&a)) { + return PigeonInternalDeepEquals(*la, std::get<::flutter::EncodableList>(b)); + } else if (const ::flutter::EncodableMap* ma = std::get_if<::flutter::EncodableMap>(&a)) { + return PigeonInternalDeepEquals(*ma, std::get<::flutter::EncodableMap>(b)); + } + return a == b; +} + +template +size_t PigeonInternalDeepHash(const T& v); + +size_t PigeonInternalDeepHash(const double& v); + +template +size_t PigeonInternalDeepHash(const std::vector& v); + +template +size_t PigeonInternalDeepHash(const std::map& v); + +template +size_t PigeonInternalDeepHash(const std::optional& v); + +template +size_t PigeonInternalDeepHash(const std::unique_ptr& v); + +size_t PigeonInternalDeepHash(const ::flutter::EncodableValue& v); + +template +size_t PigeonInternalDeepHash(const T& v) { + return std::hash()(v); +} + +template +size_t PigeonInternalDeepHash(const std::vector& v) { + size_t result = 1; + for (const auto& item : v) { + result = result * 31 + PigeonInternalDeepHash(item); + } + return result; +} + +template +size_t PigeonInternalDeepHash(const std::map& v) { + size_t result = 0; + for (const auto& kv : v) { + result += ((PigeonInternalDeepHash(kv.first) * 31) ^ PigeonInternalDeepHash(kv.second)); + } + return result; +} + +size_t PigeonInternalDeepHash(const double& v) { + if (std::isnan(v)) { + // Normalize NaN to a consistent hash. + return std::hash()(std::numeric_limits::quiet_NaN()); + } + if (v == 0.0) { + // Normalize -0.0 to 0.0 so they have the same hash code. + return std::hash()(0.0); + } + return std::hash()(v); +} + +template +size_t PigeonInternalDeepHash(const std::optional& v) { + return v ? PigeonInternalDeepHash(*v) : 0; +} + +template +size_t PigeonInternalDeepHash(const std::unique_ptr& v) { + return v ? PigeonInternalDeepHash(*v) : 0; +} + +size_t PigeonInternalDeepHash(const ::flutter::EncodableValue& v) { + size_t result = v.index(); + if (const double* dv = std::get_if(&v)) { + result = result * 31 + PigeonInternalDeepHash(*dv); + } else if (const ::flutter::EncodableList* lv = + std::get_if<::flutter::EncodableList>(&v)) { + result = result * 31 + PigeonInternalDeepHash(*lv); + } else if (const ::flutter::EncodableMap* mv = + std::get_if<::flutter::EncodableMap>(&v)) { + result = result * 31 + PigeonInternalDeepHash(*mv); + } else { + std::visit( + [&result](const auto& val) { + using T = std::decay_t; + if constexpr (!std::is_same_v && + !std::is_same_v && + !std::is_same_v && + !std::is_same_v && + !std::is_same_v) { + result = result * 31 + PigeonInternalDeepHash(val); + } + }, + v); + } + return result; +} + +template +std::string PigeonInternalToString(const T& v); + +std::string PigeonInternalToString(const bool& v); + +template +std::string PigeonInternalToString(const std::vector& v); + +template +std::string PigeonInternalToString(const std::map& v); + +template +std::string PigeonInternalToString(const std::optional& v); + +template +std::string PigeonInternalToString(const std::unique_ptr& v); + +std::string PigeonInternalToString(const ::flutter::EncodableValue& v); + +template +std::string PigeonInternalToString(const T& v) { + std::stringstream ss; + if constexpr (std::is_enum_v) { + ss << static_cast(v); + } else { + ss << v; + } + return ss.str(); +} + +std::string PigeonInternalToString(const bool& v) { + return v ? "true" : "false"; +} + +template +std::string PigeonInternalToString(const std::vector& v) { + std::stringstream ss; + ss << "["; + for (size_t i = 0; i < v.size(); ++i) { + if (i > 0) { + ss << ", "; + } + ss << PigeonInternalToString(v[i]); + } + ss << "]"; + return ss.str(); +} + +template +std::string PigeonInternalToString(const std::map& v) { + std::stringstream ss; + ss << "{"; + bool first = true; + for (const auto& kv : v) { + if (!first) { + ss << ", "; + } + first = false; + ss << PigeonInternalToString(kv.first) << ": " << PigeonInternalToString(kv.second); + } + ss << "}"; + return ss.str(); +} + +template +std::string PigeonInternalToString(const std::optional& v) { + return v ? PigeonInternalToString(*v) : "null"; +} + +template +std::string PigeonInternalToString(const std::unique_ptr& v) { + return v ? PigeonInternalToString(*v) : "null"; +} + +std::string PigeonInternalToString(const ::flutter::EncodableValue& v) { + return std::visit( + [](const auto& val) { + using T = std::decay_t; + if constexpr (std::is_same_v) { + return std::string("null"); + } else if constexpr (std::is_same_v) { + return val ? std::string("true") : std::string("false"); + } else if constexpr (std::is_same_v) { + return "\"" + val + "\""; + } else if constexpr (std::is_same_v) { + return std::string("[custom]"); + } else { + return PigeonInternalToString(val); + } + }, + v); +} + +} // namespace PigeonInternalCodecSerializer::PigeonInternalCodecSerializer() {} EncodableValue PigeonInternalCodecSerializer::ReadValueOfType( uint8_t type, - flutter::ByteStreamReader* stream) const { - return flutter::StandardCodecSerializer::ReadValueOfType(type, stream); + ::flutter::ByteStreamReader* stream) const { + return ::flutter::StandardCodecSerializer::ReadValueOfType(type, stream); } void PigeonInternalCodecSerializer::WriteValue( const EncodableValue& value, - flutter::ByteStreamWriter* stream) const { - flutter::StandardCodecSerializer::WriteValue(value, stream); + ::flutter::ByteStreamWriter* stream) const { + ::flutter::StandardCodecSerializer::WriteValue(value, stream); } /// The codec used by NativeQueryHostApi. -const flutter::StandardMessageCodec& NativeQueryHostApi::GetCodec() { - return flutter::StandardMessageCodec::GetInstance(&PigeonInternalCodecSerializer::GetInstance()); +const ::flutter::StandardMessageCodec& NativeQueryHostApi::GetCodec() { + return ::flutter::StandardMessageCodec::GetInstance(&PigeonInternalCodecSerializer::GetInstance()); } // Sets up an instance of `NativeQueryHostApi` to handle messages through the `binary_messenger`. void NativeQueryHostApi::SetUp( - flutter::BinaryMessenger* binary_messenger, + ::flutter::BinaryMessenger* binary_messenger, NativeQueryHostApi* api) { NativeQueryHostApi::SetUp(binary_messenger, api, ""); } void NativeQueryHostApi::SetUp( - flutter::BinaryMessenger* binary_messenger, + ::flutter::BinaryMessenger* binary_messenger, NativeQueryHostApi* api, const std::string& message_channel_suffix) { const std::string prepended_suffix = message_channel_suffix.length() > 0 ? std::string(".") + message_channel_suffix : ""; { BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.getCapabilities" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { try { api->GetCapabilities([reply](ErrorOr&& output) { if (output.has_error()) { @@ -85,7 +376,7 @@ void NativeQueryHostApi::SetUp( { BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.query" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { try { const auto& args = std::get(message); const auto& encodable_request_arg = args.at(0); @@ -114,7 +405,7 @@ void NativeQueryHostApi::SetUp( { BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.mutate" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { try { const auto& args = std::get(message); const auto& encodable_request_arg = args.at(0); @@ -143,7 +434,7 @@ void NativeQueryHostApi::SetUp( { BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.batch" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { try { const auto& args = std::get(message); const auto& encodable_request_arg = args.at(0); @@ -172,7 +463,7 @@ void NativeQueryHostApi::SetUp( { BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.observeStart" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { try { const auto& args = std::get(message); const auto& encodable_request_arg = args.at(0); @@ -201,7 +492,7 @@ void NativeQueryHostApi::SetUp( { BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.observeStop" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { try { const auto& args = std::get(message); const auto& encodable_observer_id_arg = args.at(0); @@ -229,7 +520,7 @@ void NativeQueryHostApi::SetUp( { BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.openBinary" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { try { const auto& args = std::get(message); const auto& encodable_request_arg = args.at(0); @@ -258,7 +549,7 @@ void NativeQueryHostApi::SetUp( { BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.closeBinary" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { try { const auto& args = std::get(message); const auto& encodable_handle_id_arg = args.at(0); @@ -286,7 +577,7 @@ void NativeQueryHostApi::SetUp( { BasicMessageChannel<> channel(binary_messenger, "dev.flutter.pigeon.simple_query_windows.NativeQueryHostApi.callExtension" + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel.SetMessageHandler([api](const EncodableValue& message, const flutter::MessageReply& reply) { + channel.SetMessageHandler([api](const EncodableValue& message, const ::flutter::MessageReply& reply) { try { const auto& args = std::get(message); const auto& encodable_extension_namespace_arg = args.at(0); @@ -344,18 +635,18 @@ EncodableValue NativeQueryHostApi::WrapError(const FlutterError& error) { } // Generated class from Pigeon that represents Flutter messages that can be called from C++. -NativeQueryFlutterApi::NativeQueryFlutterApi(flutter::BinaryMessenger* binary_messenger) +NativeQueryFlutterApi::NativeQueryFlutterApi(::flutter::BinaryMessenger* binary_messenger) : binary_messenger_(binary_messenger), message_channel_suffix_("") {} NativeQueryFlutterApi::NativeQueryFlutterApi( - flutter::BinaryMessenger* binary_messenger, + ::flutter::BinaryMessenger* binary_messenger, const std::string& message_channel_suffix) : binary_messenger_(binary_messenger), message_channel_suffix_(message_channel_suffix.length() > 0 ? std::string(".") + message_channel_suffix : "") {} -const flutter::StandardMessageCodec& NativeQueryFlutterApi::GetCodec() { - return flutter::StandardMessageCodec::GetInstance(&PigeonInternalCodecSerializer::GetInstance()); +const ::flutter::StandardMessageCodec& NativeQueryFlutterApi::GetCodec() { + return ::flutter::StandardMessageCodec::GetInstance(&PigeonInternalCodecSerializer::GetInstance()); } void NativeQueryFlutterApi::OnObserveEvent( diff --git a/packages/simple_query_windows/windows/native_query.g.h b/packages/simple_query_windows/windows/native_query.g.h index 4af4923..0c1d442 100644 --- a/packages/simple_query_windows/windows/native_query.g.h +++ b/packages/simple_query_windows/windows/native_query.g.h @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v22.7.4), do not edit directly. +// Autogenerated from Pigeon (v30.0.4), do not edit directly. // See also: https://pub.dev/packages/pigeon #ifndef PIGEON_NATIVE_QUERY_G_H_ @@ -10,6 +10,7 @@ #include #include +#include #include namespace simple_query_windows { @@ -23,17 +24,17 @@ class FlutterError { : code_(code) {} explicit FlutterError(const std::string& code, const std::string& message) : code_(code), message_(message) {} - explicit FlutterError(const std::string& code, const std::string& message, const flutter::EncodableValue& details) + explicit FlutterError(const std::string& code, const std::string& message, const ::flutter::EncodableValue& details) : code_(code), message_(message), details_(details) {} const std::string& code() const { return code_; } const std::string& message() const { return message_; } - const flutter::EncodableValue& details() const { return details_; } + const ::flutter::EncodableValue& details() const { return details_; } private: std::string code_; std::string message_; - flutter::EncodableValue details_; + ::flutter::EncodableValue details_; }; template class ErrorOr { @@ -58,7 +59,7 @@ template class ErrorOr { -class PigeonInternalCodecSerializer : public flutter::StandardCodecSerializer { +class PigeonInternalCodecSerializer : public ::flutter::StandardCodecSerializer { public: PigeonInternalCodecSerializer(); inline static PigeonInternalCodecSerializer& GetInstance() { @@ -67,14 +68,12 @@ class PigeonInternalCodecSerializer : public flutter::StandardCodecSerializer { } void WriteValue( - const flutter::EncodableValue& value, - flutter::ByteStreamWriter* stream) const override; - + const ::flutter::EncodableValue& value, + ::flutter::ByteStreamWriter* stream) const override; protected: - flutter::EncodableValue ReadValueOfType( + ::flutter::EncodableValue ReadValueOfType( uint8_t type, - flutter::ByteStreamReader* stream) const override; - + ::flutter::ByteStreamReader* stream) const override; }; // Generated interface from Pigeon that represents a handler of messages from Flutter. @@ -83,23 +82,23 @@ class NativeQueryHostApi { NativeQueryHostApi(const NativeQueryHostApi&) = delete; NativeQueryHostApi& operator=(const NativeQueryHostApi&) = delete; virtual ~NativeQueryHostApi() {} - virtual void GetCapabilities(std::function reply)> result) = 0; + virtual void GetCapabilities(std::function reply)> result) = 0; virtual void Query( - const flutter::EncodableMap& request, - std::function reply)> result) = 0; + const ::flutter::EncodableMap& request, + std::function reply)> result) = 0; virtual void Mutate( - const flutter::EncodableMap& request, - std::function reply)> result) = 0; + const ::flutter::EncodableMap& request, + std::function reply)> result) = 0; virtual void Batch( - const flutter::EncodableMap& request, - std::function reply)> result) = 0; + const ::flutter::EncodableMap& request, + std::function reply)> result) = 0; virtual void ObserveStart( - const flutter::EncodableMap& request, + const ::flutter::EncodableMap& request, std::function reply)> result) = 0; virtual std::optional ObserveStop(const std::string& observer_id) = 0; virtual void OpenBinary( - const flutter::EncodableMap& request, - std::function reply)> result) = 0; + const ::flutter::EncodableMap& request, + std::function reply)> result) = 0; virtual std::optional CloseBinary(const std::string& handle_id) = 0; // Purpose: Calls a namespaced Windows-only extension. // @@ -109,42 +108,39 @@ class NativeQueryHostApi { virtual void CallExtension( const std::string& extension_namespace, const std::string& method, - const flutter::EncodableMap* args, - std::function> reply)> result) = 0; + const ::flutter::EncodableMap* args, + std::function> reply)> result) = 0; // The codec used by NativeQueryHostApi. - static const flutter::StandardMessageCodec& GetCodec(); + static const ::flutter::StandardMessageCodec& GetCodec(); // Sets up an instance of `NativeQueryHostApi` to handle messages through the `binary_messenger`. static void SetUp( - flutter::BinaryMessenger* binary_messenger, + ::flutter::BinaryMessenger* binary_messenger, NativeQueryHostApi* api); static void SetUp( - flutter::BinaryMessenger* binary_messenger, + ::flutter::BinaryMessenger* binary_messenger, NativeQueryHostApi* api, const std::string& message_channel_suffix); - static flutter::EncodableValue WrapError(std::string_view error_message); - static flutter::EncodableValue WrapError(const FlutterError& error); - + static ::flutter::EncodableValue WrapError(std::string_view error_message); + static ::flutter::EncodableValue WrapError(const FlutterError& error); protected: NativeQueryHostApi() = default; - }; // Generated class from Pigeon that represents Flutter messages that can be called from C++. class NativeQueryFlutterApi { public: - NativeQueryFlutterApi(flutter::BinaryMessenger* binary_messenger); + NativeQueryFlutterApi(::flutter::BinaryMessenger* binary_messenger); NativeQueryFlutterApi( - flutter::BinaryMessenger* binary_messenger, + ::flutter::BinaryMessenger* binary_messenger, const std::string& message_channel_suffix); - static const flutter::StandardMessageCodec& GetCodec(); + static const ::flutter::StandardMessageCodec& GetCodec(); void OnObserveEvent( const std::string& observer_id, - const flutter::EncodableMap& event, + const ::flutter::EncodableMap& event, std::function&& on_success, std::function&& on_error); - private: - flutter::BinaryMessenger* binary_messenger_; + ::flutter::BinaryMessenger* binary_messenger_; std::string message_channel_suffix_; }; diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..75ec782 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,302 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + ansi_styles: + dependency: transitive + description: + name: ansi_styles + sha256: "9c656cc12b3c27b17dd982b2cc5c0cfdfbdabd7bc8f3ae5e8542d9867b47ce8a" + url: "https://pub.dev" + source: hosted + version: "0.3.2+1" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + charcode: + dependency: transitive + description: + name: charcode + sha256: fb0f1107cac15a5ea6ef0a6ef71a807b9e4267c713bb93e00e92d737cc8dbd8a + url: "https://pub.dev" + source: hosted + version: "1.4.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" + url: "https://pub.dev" + source: hosted + version: "2.0.4" + cli_launcher: + dependency: transitive + description: + name: cli_launcher + sha256: ff37bcc6d5fa25ab7ddcf255a60900b28e4e1712d34495e5f7952e0982933913 + url: "https://pub.dev" + source: hosted + version: "0.3.4+1" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.dev" + source: hosted + version: "0.4.2" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + conventional_commit: + dependency: transitive + description: + name: conventional_commit + sha256: c40b1b449ce2a63fa2ce852f35e3890b1e182f5951819934c0e4a66254bc0dc3 + url: "https://pub.dev" + source: hosted + version: "0.6.1+1" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: "218aeb56050c714f62a3182775320dfa04602b55074873e24e31bbd39bda96fb" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + http: + dependency: transitive + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + io: + dependency: transitive + description: + name: io + sha256: "2635216ca6a737e60de577ffa1a48a0bec76ca8a62917cfc1bb88c14c570646f" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "2a743920d81b7910627f68ee2c9ac1fc0bfee32b9fc3403587d7c6791ca12f80" + url: "https://pub.dev" + source: hosted + version: "4.12.0" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + melos: + dependency: "direct dev" + description: + name: melos + sha256: "4280dc46bd5b741887cce1e67e5c1a6aaf3c22310035cf5bd33dceeeda62ed22" + url: "https://pub.dev" + source: hosted + version: "6.3.3" + meta: + dependency: transitive + description: + name: meta + sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" + url: "https://pub.dev" + source: hosted + version: "1.19.0" + mustache_template: + dependency: transitive + description: + name: mustache_template + sha256: "17a8de9072575bb1a3237b90ed1f756b2189995b334df2ad12b7cdd76b13f3ce" + url: "https://pub.dev" + source: hosted + version: "2.0.6" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + platform: + dependency: transitive + description: + name: platform + sha256: a36d119c13416516a7b5913fbe8af8531e11633d784c550b2125f76c758524ec + url: "https://pub.dev" + source: hosted + version: "3.2.0" + pool: + dependency: transitive + description: + name: pool + sha256: "4177f68c237ea2128d1bee66ac17b2ce05ba3dbaafcbdd54c5d40a39d0b6b11c" + url: "https://pub.dev" + source: hosted + version: "1.5.3" + process: + dependency: transitive + description: + name: process + sha256: "4242ba3508d37e01808bdf71ad1d5bb93a8d671bf2e7450e6b1b353fb0808891" + url: "https://pub.dev" + source: hosted + version: "5.0.6" + prompts: + dependency: transitive + description: + name: prompts + sha256: "3773b845e85a849f01e793c4fc18a45d52d7783b4cb6c0569fad19f9d0a774a1" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "261236774e8b1d69cfc6b9eabbc96c40f25e7a2d6b171f3385d4f65d5734fb24" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + pub_updater: + dependency: transitive + description: + name: pub_updater + sha256: "739a0161d73a6974c0675b864fb0cf5147305f7b077b7f03a58fa7a9ab3e7e7d" + url: "https://pub.dev" + source: hosted + version: "0.5.0" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: "9ac81c01ffd6a9cf9b2713288834fbaaf6aebde05ffdf02d380e68b8e06f27d8" + url: "https://pub.dev" + source: hosted + version: "1.7.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490" + url: "https://pub.dev" + source: hosted + version: "1.12.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + web: + dependency: transitive + description: + name: web + sha256: e119e82ac4795c7925103b7cf3768191f33941b99e7ccffbd6c645201d9f606b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + yaml: + dependency: transitive + description: + name: yaml + sha256: f67cdd8e07d3c6329146aaef1ba043542b3134c12489f553ca9a7435d1068aea + url: "https://pub.dev" + source: hosted + version: "3.1.4" + yaml_edit: + dependency: transitive + description: + name: yaml_edit + sha256: "07c9e63ba42519745182b88ca12264a7ba2484d8239958778dfe4d44fe760488" + url: "https://pub.dev" + source: hosted + version: "2.2.4" +sdks: + dart: ">=3.13.0 <4.0.0" + flutter: ">=3.47.7" diff --git a/pubspec.yaml b/pubspec.yaml index 00670a9..b4ee73f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,8 +4,9 @@ description: Workspace root for the simple_query federated plugin. version: 0.0.0 environment: - sdk: ^3.6.0 + sdk: ^3.13.0 + flutter: '>=3.47.7' dev_dependencies: - flutter_lints: ^5.0.0 - melos: ^6.3.2 + flutter_lints: 6.0.0 + melos: 6.3.3