Add punctuation examples for Flutter - #3846
Conversation
📝 WalkthroughWalkthroughThis PR adds offline and online Flutter punctuation examples for Android, iOS, Linux, macOS, Windows, and web. It adds native isolate and web-worker processing, WASM punctuation bindings, model loading, platform runners, build configuration, and documentation. ChangesWASM punctuation runtime
Offline punctuation application
Online punctuation application
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant PunctScreen
participant PunctManager
participant WebWorker
participant NativeIsolate
participant WASM
User->>PunctScreen: submit text
PunctScreen->>PunctManager: initialize and punctuate
PunctManager->>WebWorker: send request on web
PunctManager->>NativeIsolate: send request on native
WebWorker->>WASM: process text
NativeIsolate->>WASM: process text when using web bindings
WASM-->>WebWorker: return punctuated text
NativeIsolate-->>PunctManager: return punctuated text and elapsed time
WebWorker-->>PunctManager: return punctuated text and elapsed time
PunctManager-->>PunctScreen: publish result and status
PunctScreen-->>User: display punctuated text
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 15
Note
Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.
🟡 Minor comments (7)
flutter-examples/offline-punctuation/web/punct-worker.js-111-133 (1)
111-133: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winFree
textPtrinfinallyand report an earlypunctuatefailure.
punctuateis only processed whilepunctexists. If the worker later receivesdisposewhile apunctuatemessage is in flight, the message matches no branch and produces no reply. If the call betweenModule._malloc()and free throws,Module._free(textPtr)also runs after the worker has already sent an error message. Move the free intofinally, send an error when the request cannot be handled, and terminate the request path before the main message handling returns.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@flutter-examples/offline-punctuation/web/punct-worker.js` around lines 111 - 133, Update the punctuate handling around the message dispatcher so requests received without an available punct instance send an error response and return immediately. Scope textPtr so the allocation is released from a finally block on every path, including exceptions between Module._malloc and the current cleanup, while preserving result-text cleanup and normal result responses.flutter-examples/online-punctuation/lib/punct_controls.dart-37-75 (1)
37-75: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winPrevent input changes during processing.
The input field, Clear button, and Example button remain active while a request runs. A result can then apply to text that differs from the submitted request.
Set the input field to read-only while
isProcessingis true. Disable Clear and Example during that state, or attach request IDs and discard stale results.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@flutter-examples/online-punctuation/lib/punct_controls.dart` around lines 37 - 75, Update the controls around the input TextField and the onClear/onExample buttons to prevent edits while isProcessing is true: set the TextField read-only and disable Clear and Example during processing, while preserving their existing behavior otherwise.flutter-examples/online-punctuation/lib/punct_manager.dart-100-113 (1)
100-113: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winClose the native receive port before closing the controllers.
receivePortand its listener remain active afterdispose(). A queued_PunctDoneor_WorkerErrorcan call.add()after_resultControlleror_logControllercloses.Store the
ReceivePortand its subscription. Cancel the subscription and close the port before closing the stream controllers.Also applies to: 160-185
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@flutter-examples/online-punctuation/lib/punct_manager.dart` around lines 100 - 113, Update the isolate lifecycle in dispose() and the corresponding initialization flow to retain the ReceivePort and its listener subscription. Cancel the subscription and close the ReceivePort before closing _logController and _resultController, preventing queued _PunctDone or _WorkerError callbacks from adding to closed controllers.flutter-examples/online-punctuation/README.md-21-38 (1)
21-38: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winSpecify a language for both example text blocks.
markdownlintreports MD040 for the fences on Lines 21 and 38. Addtextto both opening fences.Proposed fix
-``` +```text🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@flutter-examples/online-punctuation/README.md` around lines 21 - 38, Update both fenced example text blocks in the README to use an explicit text language identifier on their opening fences, including the input paragraph and output text block.Source: Linters/SAST tools
flutter-examples/online-punctuation/lib/model_web.dart-3-5 (1)
3-5: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winRequire Flutter SDK levels that support this web code.
flutter-examples/online-punctuation/pubspec.yamlonly requiresflutter: ">=2.8.1"while the web sources importdart:js_interop,dart:js_interop_unsafe, andpackage:web, which are unavailable in Flutter 2.8.1. Raise the project SDK constraint or add platform-aware code that supports the lower SDK.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@flutter-examples/online-punctuation/lib/model_web.dart` around lines 3 - 5, Raise the Flutter SDK constraint in flutter-examples/online-punctuation/pubspec.yaml to a version supporting dart:js_interop, dart:js_interop_unsafe, and package:web, preserving the existing web implementations in model_web.dart and worker_web.dart without adding lower-SDK compatibility code.flutter-examples/online-punctuation/web/punct-worker.js-117-127 (1)
117-127: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winRelease request buffers on every error path.
After line 118 allocates
textPtr, an exception from encoding, native punctuation, or UTF-8 conversion skips lines 124-127. Each failed request then retains WASM heap memory.Move both frees into a
finallyblock.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@flutter-examples/online-punctuation/web/punct-worker.js` around lines 117 - 127, Update the request-processing flow around textPtr and resultPtr so both allocated buffers are released in a finally block, including when encoding, native punctuation, or UTF-8 conversion throws. Preserve the existing conditional release for resultPtr and always release textPtr after the attempt.flutter-examples/online-punctuation/web/punct-worker.js-96-105 (1)
96-105: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winKeep initialization state and ownership valid on failure.
Line 98 assigns
punctbefore the handle check. If creation returns zero,punctuateaccepts the non-null object and calls the native API with a zero handle. If native creation throws, line 100 does not free the configuration buffers.Store the handle locally. Free
configin afinallyblock. Assignpunctonly after a nonzero handle is confirmed.Proposed fix
const config = initSherpaOnnxOnlinePunctuationConfig(msg.config, Module); - punct = { - handle: Module._SherpaOnnxCreateOnlinePunctuation(config.ptr), - }; - freeConfig(config, Module); + let handle = 0; + try { + handle = Module._SherpaOnnxCreateOnlinePunctuation(config.ptr); + } finally { + freeConfig(config, Module); + } - if (!punct.handle) { + if (!handle) { self.postMessage({ type: 'error', message: 'Failed to create punctuation (null handle)' }); return; } + punct = { handle: handle };🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@flutter-examples/online-punctuation/web/punct-worker.js` around lines 96 - 105, Update the initialization flow around initSherpaOnnxOnlinePunctuationConfig and _SherpaOnnxCreateOnlinePunctuation to store the native handle locally, free config in a finally block even when creation throws, and assign punct only after confirming the handle is nonzero. Preserve the existing error message and return behavior for failed creation.
🧹 Nitpick comments (1)
flutter-examples/offline-punctuation/README.md (1)
21-21: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdd language identifiers to the text examples.
Add
textafter both opening fences. This satisfies MD040 and preserves the rendered output.Proposed change
-``` +```text yesterday afternoon 我去了一家 near my apartment 的 coffee shop 想要 ... -``` +``` -``` +```text yesterday afternoon,我去了一家near my apartment的coffee shop,想要 ... -``` +```Also applies to: 32-32
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@flutter-examples/offline-punctuation/README.md` at line 21, Add the text language identifier to both opening Markdown code fences in the README examples, including the second occurrence, while leaving the example contents and rendered output unchanged.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@flutter-examples/offline-punctuation/lib/model_web.dart`:
- Around line 3-5: Update the SDK constraint for the offline-punctuation example
to require Dart >=3.3.0, covering the JS interop imports used by model_web.dart
and worker_web.dart; keep the existing dart:js_interop, dart:js_interop_unsafe,
and package:web usage unchanged.
In `@flutter-examples/offline-punctuation/lib/punct_controls.dart`:
- Around line 37-75: Update the widget controls around the input TextField and
the onClear/onExample buttons so input mutations are disabled while isProcessing
is true: prevent editing the input and disable both Clear and Example, while
preserving the existing Punctuate loading behavior. Ensure the active request
cannot be overwritten by changes made during processing.
In `@flutter-examples/offline-punctuation/lib/punct_manager.dart`:
- Around line 71-80: Update PunctManager.init() to store the in-progress
initialization Future when transitioning to PunctState.initializing, and have
subsequent callers await that same Future instead of returning immediately.
Ensure both _initWeb() and _initNative() are covered, while preserving the
existing initialized fast path so punctuate() cannot run before setup completes.
- Around line 131-143: Publish initialization failures at
flutter-examples/offline-punctuation/lib/punct_manager.dart:131-143 and runtime
worker failures at
flutter-examples/offline-punctuation/lib/punct_manager.dart:176-181 through one
structured error result or error stream, rather than only _logController. In
flutter-examples/offline-punctuation/lib/punct_screen.dart:54-75, check
isInitialized before dispatching punctuation and reset _isProcessing when the
manager reports that error.
In `@flutter-examples/offline-punctuation/test/widget_test.dart`:
- Around line 14-28: Replace the default counter test around the testWidgets
callback with coverage for PunctScreen and InfoScreen. Remove the 0/1 text and
Icons.add assertions, and instead locate the stable PunctControls Input, Result,
and Punctuate UI targets to verify the punctuation flow; add field/action
identifiers only if those labels are not sufficient.
In `@flutter-examples/offline-punctuation/web/punct-worker.js`:
- Around line 100-103: In the null-handle branch of the punctuation
initialization flow, set the `punct` state to `null` before posting the error
and returning. Keep the existing error message and control flow unchanged so
later `punctuate` and cleanup handlers cannot use or destroy the invalid handle.
In `@flutter-examples/offline-punctuation/windows/runner/utils.cpp`:
- Around line 48-57: Update the UTF-16 conversion logic around
WideCharToMultiByte so its first return value is validated for zero before
subtracting the trailing null terminator. Only compute target_length after
confirming a successful, nonzero result, preserving the existing max_size guard
and resize behavior in the conversion helper.
In `@flutter-examples/online-punctuation/ios/Runner.xcodeproj/project.pbxproj`:
- Around line 379-386: Remove the hard-coded DEVELOPMENT_TEAM setting from all
affected build configurations in the Xcode project, including the repeated
entries referenced by the comment. Leave signing team selection to local or
untracked configuration without changing the surrounding build settings.
In `@flutter-examples/online-punctuation/lib/punct_screen.dart`:
- Around line 41-79: Update _initIfNeeded() to return whether initialization
succeeded, and have _onPunctuate() stop before setting _isProcessing or calling
punctuate when initialization fails. Add a manager error event for failed
requests, subscribe to it in the screen setup, and have its handler reset
_isProcessing while updating the log appropriately.
In `@flutter-examples/online-punctuation/lib/worker_web.dart`:
- Around line 63-79: Update the worker initialization flow around initMsg and
_worker!.postMessage to transfer, rather than clone, wasmData.buffer and every
model buffer stored in jsModelFiles. Build a transfer list containing the WASM
ArrayBuffer and all model ArrayBuffers, pass it to postMessage, and avoid
accessing those buffers after the transfer.
In `@flutter-examples/online-punctuation/pubspec.yaml`:
- Around line 27-28: Add the punctuation model asset directory under the Flutter
assets configuration in pubspec.yaml, and update generate-asset-list.py so its
generated asset list remains synchronized with the bundled model files. Ensure
the existing cnnBiLstm and bpeVocab asset paths resolve from the bundled model
directory.
In `@flutter-examples/online-punctuation/test/widget_test.dart`:
- Around line 14-28: Replace the copied counter test in MyApp’s widget test with
assertions matching the punctuation app’s Home Page, PunctScreen, or InfoScreen
UI, removing the invalid counter text and add-icon interactions. In
flutter-examples/online-punctuation/pubspec.yaml lines 27-28, add flutter_test
under dev_dependencies if this test remains part of the package.
In `@flutter-examples/online-punctuation/windows/runner/utils.cpp`:
- Around line 48-57: Update the conversion sizing logic near WideCharToMultiByte
to store its result in a signed variable, return the empty string immediately
when the sizing call returns 0, and only then compute target_length as
required_length minus one. Preserve the existing max_size validation before
resizing utf8_string.
In `@flutter-examples/tts/lib/worker_web.dart`:
- Around line 134-138: Update _loadAssetBytes to return a compacted Uint8List
copy of the asset range, ensuring callers using wasmData.buffer.toJS receive
only the asset bytes rather than the underlying buffer. Preserve the existing
asset loading and range selection behavior.
In `@flutter/sherpa_onnx/lib/src/web/tts.dart`:
- Around line 82-86: Update the referenceAudio assignment in the TTS generation
configuration block to convert the Dart Float32List with .toJS before storing it
in genConfig, replacing the unsafe as JSAny cast while preserving the existing
null and non-empty checks.
---
Minor comments:
In `@flutter-examples/offline-punctuation/web/punct-worker.js`:
- Around line 111-133: Update the punctuate handling around the message
dispatcher so requests received without an available punct instance send an
error response and return immediately. Scope textPtr so the allocation is
released from a finally block on every path, including exceptions between
Module._malloc and the current cleanup, while preserving result-text cleanup and
normal result responses.
In `@flutter-examples/online-punctuation/lib/model_web.dart`:
- Around line 3-5: Raise the Flutter SDK constraint in
flutter-examples/online-punctuation/pubspec.yaml to a version supporting
dart:js_interop, dart:js_interop_unsafe, and package:web, preserving the
existing web implementations in model_web.dart and worker_web.dart without
adding lower-SDK compatibility code.
In `@flutter-examples/online-punctuation/lib/punct_controls.dart`:
- Around line 37-75: Update the controls around the input TextField and the
onClear/onExample buttons to prevent edits while isProcessing is true: set the
TextField read-only and disable Clear and Example during processing, while
preserving their existing behavior otherwise.
In `@flutter-examples/online-punctuation/lib/punct_manager.dart`:
- Around line 100-113: Update the isolate lifecycle in dispose() and the
corresponding initialization flow to retain the ReceivePort and its listener
subscription. Cancel the subscription and close the ReceivePort before closing
_logController and _resultController, preventing queued _PunctDone or
_WorkerError callbacks from adding to closed controllers.
In `@flutter-examples/online-punctuation/README.md`:
- Around line 21-38: Update both fenced example text blocks in the README to use
an explicit text language identifier on their opening fences, including the
input paragraph and output text block.
In `@flutter-examples/online-punctuation/web/punct-worker.js`:
- Around line 117-127: Update the request-processing flow around textPtr and
resultPtr so both allocated buffers are released in a finally block, including
when encoding, native punctuation, or UTF-8 conversion throws. Preserve the
existing conditional release for resultPtr and always release textPtr after the
attempt.
- Around line 96-105: Update the initialization flow around
initSherpaOnnxOnlinePunctuationConfig and _SherpaOnnxCreateOnlinePunctuation to
store the native handle locally, free config in a finally block even when
creation throws, and assign punct only after confirming the handle is nonzero.
Preserve the existing error message and return behavior for failed creation.
---
Nitpick comments:
In `@flutter-examples/offline-punctuation/README.md`:
- Line 21: Add the text language identifier to both opening Markdown code fences
in the README examples, including the second occurrence, while leaving the
example contents and rendered output unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: dc3e5a47-199c-43ad-b581-99a7c856d046
⛔ Files ignored due to path filters (78)
flutter-examples/offline-punctuation/android/app/src/main/res/mipmap-hdpi/ic_launcher.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/android/app/src/main/res/mipmap-mdpi/ic_launcher.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/android/app/src/main/res/mipmap-xhdpi/ic_launcher.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedatais excluded by!**/*.xcworkspace/contents.xcworkspacedataflutter-examples/offline-punctuation/ios/Runner.xcworkspace/contents.xcworkspacedatais excluded by!**/*.xcworkspace/contents.xcworkspacedataflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/macos/Runner.xcworkspace/contents.xcworkspacedatais excluded by!**/*.xcworkspace/contents.xcworkspacedataflutter-examples/offline-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/web/favicon.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/web/icons/Icon-192.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/web/icons/Icon-512.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/web/icons/Icon-maskable-192.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/web/icons/Icon-maskable-512.pngis excluded by!**/*.pngflutter-examples/offline-punctuation/windows/runner/resources/app_icon.icois excluded by!**/*.icoflutter-examples/online-punctuation/android/app/src/main/res/mipmap-hdpi/ic_launcher.pngis excluded by!**/*.pngflutter-examples/online-punctuation/android/app/src/main/res/mipmap-mdpi/ic_launcher.pngis excluded by!**/*.pngflutter-examples/online-punctuation/android/app/src/main/res/mipmap-xhdpi/ic_launcher.pngis excluded by!**/*.pngflutter-examples/online-punctuation/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.pngis excluded by!**/*.pngflutter-examples/online-punctuation/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedatais excluded by!**/*.xcworkspace/contents.xcworkspacedataflutter-examples/online-punctuation/ios/Runner.xcworkspace/contents.xcworkspacedatais excluded by!**/*.xcworkspace/contents.xcworkspacedataflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.pngis excluded by!**/*.pngflutter-examples/online-punctuation/macos/Runner.xcworkspace/contents.xcworkspacedatais excluded by!**/*.xcworkspace/contents.xcworkspacedataflutter-examples/online-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.pngis excluded by!**/*.pngflutter-examples/online-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.pngis excluded by!**/*.pngflutter-examples/online-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.pngis excluded by!**/*.pngflutter-examples/online-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.pngis excluded by!**/*.pngflutter-examples/online-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.pngis excluded by!**/*.pngflutter-examples/online-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.pngis excluded by!**/*.pngflutter-examples/online-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.pngis excluded by!**/*.pngflutter-examples/online-punctuation/web/favicon.pngis excluded by!**/*.pngflutter-examples/online-punctuation/web/icons/Icon-192.pngis excluded by!**/*.pngflutter-examples/online-punctuation/web/icons/Icon-512.pngis excluded by!**/*.pngflutter-examples/online-punctuation/web/icons/Icon-maskable-192.pngis excluded by!**/*.pngflutter-examples/online-punctuation/web/icons/Icon-maskable-512.pngis excluded by!**/*.pngflutter-examples/online-punctuation/windows/runner/resources/app_icon.icois excluded by!**/*.ico
📒 Files selected for processing (194)
cmake/simple-sentencepiece.cmakeflutter-examples/offline-punctuation/.gitignoreflutter-examples/offline-punctuation/.metadataflutter-examples/offline-punctuation/README.mdflutter-examples/offline-punctuation/analysis_options.yamlflutter-examples/offline-punctuation/android/.gitignoreflutter-examples/offline-punctuation/android/app/build.gradle.ktsflutter-examples/offline-punctuation/android/app/src/debug/AndroidManifest.xmlflutter-examples/offline-punctuation/android/app/src/main/AndroidManifest.xmlflutter-examples/offline-punctuation/android/app/src/main/kotlin/com/example/offline_punctuation/MainActivity.ktflutter-examples/offline-punctuation/android/app/src/main/res/drawable-v21/launch_background.xmlflutter-examples/offline-punctuation/android/app/src/main/res/drawable/launch_background.xmlflutter-examples/offline-punctuation/android/app/src/main/res/values-night/styles.xmlflutter-examples/offline-punctuation/android/app/src/main/res/values/styles.xmlflutter-examples/offline-punctuation/android/app/src/profile/AndroidManifest.xmlflutter-examples/offline-punctuation/android/build.gradle.ktsflutter-examples/offline-punctuation/android/gradle.propertiesflutter-examples/offline-punctuation/android/gradle/wrapper/gradle-wrapper.propertiesflutter-examples/offline-punctuation/android/settings.gradle.ktsflutter-examples/offline-punctuation/assets/.gitkeepflutter-examples/offline-punctuation/generate-asset-list.pyflutter-examples/offline-punctuation/ios/.gitignoreflutter-examples/offline-punctuation/ios/Flutter/AppFrameworkInfo.plistflutter-examples/offline-punctuation/ios/Flutter/Debug.xcconfigflutter-examples/offline-punctuation/ios/Flutter/Release.xcconfigflutter-examples/offline-punctuation/ios/Runner.xcodeproj/project.pbxprojflutter-examples/offline-punctuation/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plistflutter-examples/offline-punctuation/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettingsflutter-examples/offline-punctuation/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcschemeflutter-examples/offline-punctuation/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plistflutter-examples/offline-punctuation/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettingsflutter-examples/offline-punctuation/ios/Runner/AppDelegate.swiftflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.jsonflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.jsonflutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.mdflutter-examples/offline-punctuation/ios/Runner/Base.lproj/LaunchScreen.storyboardflutter-examples/offline-punctuation/ios/Runner/Base.lproj/Main.storyboardflutter-examples/offline-punctuation/ios/Runner/Info.plistflutter-examples/offline-punctuation/ios/Runner/Runner-Bridging-Header.hflutter-examples/offline-punctuation/ios/Runner/SceneDelegate.swiftflutter-examples/offline-punctuation/ios/RunnerTests/RunnerTests.swiftflutter-examples/offline-punctuation/lib/main.dartflutter-examples/offline-punctuation/lib/model.dartflutter-examples/offline-punctuation/lib/model_config.dartflutter-examples/offline-punctuation/lib/model_web.dartflutter-examples/offline-punctuation/lib/punct_controls.dartflutter-examples/offline-punctuation/lib/punct_manager.dartflutter-examples/offline-punctuation/lib/punct_screen.dartflutter-examples/offline-punctuation/lib/worker_stub.dartflutter-examples/offline-punctuation/lib/worker_web.dartflutter-examples/offline-punctuation/linux/.gitignoreflutter-examples/offline-punctuation/linux/CMakeLists.txtflutter-examples/offline-punctuation/linux/flutter/CMakeLists.txtflutter-examples/offline-punctuation/linux/runner/CMakeLists.txtflutter-examples/offline-punctuation/linux/runner/main.ccflutter-examples/offline-punctuation/linux/runner/my_application.ccflutter-examples/offline-punctuation/linux/runner/my_application.hflutter-examples/offline-punctuation/macos/.gitignoreflutter-examples/offline-punctuation/macos/Flutter/Flutter-Debug.xcconfigflutter-examples/offline-punctuation/macos/Flutter/Flutter-Release.xcconfigflutter-examples/offline-punctuation/macos/Runner.xcodeproj/project.pbxprojflutter-examples/offline-punctuation/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plistflutter-examples/offline-punctuation/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcschemeflutter-examples/offline-punctuation/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plistflutter-examples/offline-punctuation/macos/Runner/AppDelegate.swiftflutter-examples/offline-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.jsonflutter-examples/offline-punctuation/macos/Runner/Base.lproj/MainMenu.xibflutter-examples/offline-punctuation/macos/Runner/Configs/AppInfo.xcconfigflutter-examples/offline-punctuation/macos/Runner/Configs/Debug.xcconfigflutter-examples/offline-punctuation/macos/Runner/Configs/Release.xcconfigflutter-examples/offline-punctuation/macos/Runner/Configs/Warnings.xcconfigflutter-examples/offline-punctuation/macos/Runner/DebugProfile.entitlementsflutter-examples/offline-punctuation/macos/Runner/Info.plistflutter-examples/offline-punctuation/macos/Runner/MainFlutterWindow.swiftflutter-examples/offline-punctuation/macos/Runner/Release.entitlementsflutter-examples/offline-punctuation/macos/RunnerTests/RunnerTests.swiftflutter-examples/offline-punctuation/pubspec.yamlflutter-examples/offline-punctuation/test/widget_test.dartflutter-examples/offline-punctuation/web/index.htmlflutter-examples/offline-punctuation/web/manifest.jsonflutter-examples/offline-punctuation/web/punct-worker.jsflutter-examples/offline-punctuation/windows/.gitignoreflutter-examples/offline-punctuation/windows/CMakeLists.txtflutter-examples/offline-punctuation/windows/flutter/CMakeLists.txtflutter-examples/offline-punctuation/windows/runner/CMakeLists.txtflutter-examples/offline-punctuation/windows/runner/Runner.rcflutter-examples/offline-punctuation/windows/runner/flutter_window.cppflutter-examples/offline-punctuation/windows/runner/flutter_window.hflutter-examples/offline-punctuation/windows/runner/main.cppflutter-examples/offline-punctuation/windows/runner/resource.hflutter-examples/offline-punctuation/windows/runner/runner.exe.manifestflutter-examples/offline-punctuation/windows/runner/utils.cppflutter-examples/offline-punctuation/windows/runner/utils.hflutter-examples/offline-punctuation/windows/runner/win32_window.cppflutter-examples/offline-punctuation/windows/runner/win32_window.hflutter-examples/online-punctuation/.gitignoreflutter-examples/online-punctuation/.metadataflutter-examples/online-punctuation/README.mdflutter-examples/online-punctuation/analysis_options.yamlflutter-examples/online-punctuation/android/.gitignoreflutter-examples/online-punctuation/android/app/build.gradle.ktsflutter-examples/online-punctuation/android/app/src/debug/AndroidManifest.xmlflutter-examples/online-punctuation/android/app/src/main/AndroidManifest.xmlflutter-examples/online-punctuation/android/app/src/main/kotlin/com/example/online_punctuation/MainActivity.ktflutter-examples/online-punctuation/android/app/src/main/res/drawable-v21/launch_background.xmlflutter-examples/online-punctuation/android/app/src/main/res/drawable/launch_background.xmlflutter-examples/online-punctuation/android/app/src/main/res/values-night/styles.xmlflutter-examples/online-punctuation/android/app/src/main/res/values/styles.xmlflutter-examples/online-punctuation/android/app/src/profile/AndroidManifest.xmlflutter-examples/online-punctuation/android/build.gradle.ktsflutter-examples/online-punctuation/android/gradle.propertiesflutter-examples/online-punctuation/android/gradle/wrapper/gradle-wrapper.propertiesflutter-examples/online-punctuation/android/settings.gradle.ktsflutter-examples/online-punctuation/assets/.gitkeepflutter-examples/online-punctuation/generate-asset-list.pyflutter-examples/online-punctuation/ios/.gitignoreflutter-examples/online-punctuation/ios/Flutter/AppFrameworkInfo.plistflutter-examples/online-punctuation/ios/Flutter/Debug.xcconfigflutter-examples/online-punctuation/ios/Flutter/Release.xcconfigflutter-examples/online-punctuation/ios/Runner.xcodeproj/project.pbxprojflutter-examples/online-punctuation/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plistflutter-examples/online-punctuation/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettingsflutter-examples/online-punctuation/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcschemeflutter-examples/online-punctuation/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plistflutter-examples/online-punctuation/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettingsflutter-examples/online-punctuation/ios/Runner/AppDelegate.swiftflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.jsonflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.jsonflutter-examples/online-punctuation/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.mdflutter-examples/online-punctuation/ios/Runner/Base.lproj/LaunchScreen.storyboardflutter-examples/online-punctuation/ios/Runner/Base.lproj/Main.storyboardflutter-examples/online-punctuation/ios/Runner/Info.plistflutter-examples/online-punctuation/ios/Runner/Runner-Bridging-Header.hflutter-examples/online-punctuation/ios/Runner/SceneDelegate.swiftflutter-examples/online-punctuation/ios/RunnerTests/RunnerTests.swiftflutter-examples/online-punctuation/lib/main.dartflutter-examples/online-punctuation/lib/model.dartflutter-examples/online-punctuation/lib/model_config.dartflutter-examples/online-punctuation/lib/model_web.dartflutter-examples/online-punctuation/lib/punct_controls.dartflutter-examples/online-punctuation/lib/punct_manager.dartflutter-examples/online-punctuation/lib/punct_screen.dartflutter-examples/online-punctuation/lib/worker_stub.dartflutter-examples/online-punctuation/lib/worker_web.dartflutter-examples/online-punctuation/linux/.gitignoreflutter-examples/online-punctuation/linux/CMakeLists.txtflutter-examples/online-punctuation/linux/flutter/CMakeLists.txtflutter-examples/online-punctuation/linux/runner/CMakeLists.txtflutter-examples/online-punctuation/linux/runner/main.ccflutter-examples/online-punctuation/linux/runner/my_application.ccflutter-examples/online-punctuation/linux/runner/my_application.hflutter-examples/online-punctuation/macos/.gitignoreflutter-examples/online-punctuation/macos/Flutter/Flutter-Debug.xcconfigflutter-examples/online-punctuation/macos/Flutter/Flutter-Release.xcconfigflutter-examples/online-punctuation/macos/Runner.xcodeproj/project.pbxprojflutter-examples/online-punctuation/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plistflutter-examples/online-punctuation/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcschemeflutter-examples/online-punctuation/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plistflutter-examples/online-punctuation/macos/Runner/AppDelegate.swiftflutter-examples/online-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.jsonflutter-examples/online-punctuation/macos/Runner/Base.lproj/MainMenu.xibflutter-examples/online-punctuation/macos/Runner/Configs/AppInfo.xcconfigflutter-examples/online-punctuation/macos/Runner/Configs/Debug.xcconfigflutter-examples/online-punctuation/macos/Runner/Configs/Release.xcconfigflutter-examples/online-punctuation/macos/Runner/Configs/Warnings.xcconfigflutter-examples/online-punctuation/macos/Runner/DebugProfile.entitlementsflutter-examples/online-punctuation/macos/Runner/Info.plistflutter-examples/online-punctuation/macos/Runner/MainFlutterWindow.swiftflutter-examples/online-punctuation/macos/Runner/Release.entitlementsflutter-examples/online-punctuation/macos/RunnerTests/RunnerTests.swiftflutter-examples/online-punctuation/pubspec.yamlflutter-examples/online-punctuation/test/widget_test.dartflutter-examples/online-punctuation/web/index.htmlflutter-examples/online-punctuation/web/manifest.jsonflutter-examples/online-punctuation/web/punct-worker.jsflutter-examples/online-punctuation/windows/.gitignoreflutter-examples/online-punctuation/windows/CMakeLists.txtflutter-examples/online-punctuation/windows/flutter/CMakeLists.txtflutter-examples/online-punctuation/windows/runner/CMakeLists.txtflutter-examples/online-punctuation/windows/runner/Runner.rcflutter-examples/online-punctuation/windows/runner/flutter_window.cppflutter-examples/online-punctuation/windows/runner/flutter_window.hflutter-examples/online-punctuation/windows/runner/main.cppflutter-examples/online-punctuation/windows/runner/resource.hflutter-examples/online-punctuation/windows/runner/runner.exe.manifestflutter-examples/online-punctuation/windows/runner/utils.cppflutter-examples/online-punctuation/windows/runner/utils.hflutter-examples/online-punctuation/windows/runner/win32_window.cppflutter-examples/online-punctuation/windows/runner/win32_window.hflutter-examples/tts/lib/worker_web.dartflutter/sherpa_onnx/lib/src/web/offline_punctuation.dartflutter/sherpa_onnx/lib/src/web/online_punctuation.dartflutter/sherpa_onnx/lib/src/web/tts.dartwasm/nodejs/sherpa-onnx-punctuation.js
| import 'dart:convert'; | ||
| import 'dart:js_interop'; | ||
| import 'dart:js_interop_unsafe'; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '/^environment:/,/^[^[:space:]]/p' \
flutter-examples/offline-punctuation/pubspec.yaml
rg -n -C 2 \
'dart:js_interop|dart:js_interop_unsafe|package:web' \
flutter-examples/offline-punctuationRepository: k2-fsa/sherpa-onnx
Length of output: 1622
🌐 Web query:
Dart dart:js_interop stable release version Dart 3.3 package web Dart 3.3
💡 Result:
Dart 3.3 was released on February 15, 2024, and introduced a new, stable model for JavaScript interop, which included both the dart:js_interop library and the package:web package [1][2]. The key components of this release are: 1. dart:js_interop: This library was introduced in Dart 3.3 as the new, typed, and sound mechanism for interacting with JavaScript [1][3]. It uses Dart's extension types to provide a consistent and idiomatic way to define the boundary between Dart and JavaScript, supporting both JavaScript and WebAssembly (Wasm) compilation targets [3][4]. 2. package:web: Released alongside Dart 3.3, this package provides lightweight browser API bindings built on top of dart:js_interop [3][5]. It is intended to replace legacy browser libraries such as dart:html, which are now deprecated [6][4][5]. package:web aligns with MDN (Mozilla Developer Network) resources and is the recommended way to access browser APIs in modern Dart applications [1][7]. While documentation within the Dart SDK repository for version 3.3.0 contained a warning label regarding the library being a work in progress [8], the official release announcement and subsequent development confirm that dart:js_interop and package:web are the current, stable, and recommended standards for JavaScript interop in Dart [1][3][7]. Legacy interop libraries, including package:js and dart:html, have been deprecated as of Dart 3.7 [4].
Citations:
- 1: https://dart.dev/blog/new-in-dart-3-3-extension-types-javascript-interop-and-more
- 2: https://medium.com/dartlang/dart-3-3-325bf2bf6c13
- 3: https://dart.dev/blog/history-of-js-interop-in-dart
- 4: https://dart.dev/interop/js-interop/past-js-interop
- 5: https://pub.dev/documentation/web/latest/
- 6: https://dart.dev/interop/js-interop/package-web
- 7: https://dart.dev/web/libraries
- 8: https://github.com/dart-lang/sdk/blob/3.3.0/sdk/lib/js_interop/js_interop.dart
Align the Dart SDK constraint with the JS interop APIs.
flutter-examples/offline-punctuation/lib/model_web.dart and worker_web.dart import dart:js_interop, dart:js_interop_unsafe, and package:web. These APIs need Dart 3.3+. Raise the SDK constraint to at least >=3.3.0, or replace these APIs with the pre-3.3 web APIs allowed by the current constraint.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@flutter-examples/offline-punctuation/lib/model_web.dart` around lines 3 - 5,
Update the SDK constraint for the offline-punctuation example to require Dart
>=3.3.0, covering the JS interop imports used by model_web.dart and
worker_web.dart; keep the existing dart:js_interop, dart:js_interop_unsafe, and
package:web usage unchanged.
| TextField( | ||
| decoration: InputDecoration( | ||
| border: const OutlineInputBorder(), | ||
| hintText: 'Enter text without punctuation', | ||
| labelText: 'Input', | ||
| contentPadding: | ||
| const EdgeInsets.symmetric(horizontal: 12, vertical: 8), | ||
| suffixIcon: IconButton( | ||
| icon: const Icon(Icons.copy, size: 18), | ||
| tooltip: 'Copy input', | ||
| onPressed: () => _copyToClipboard(context, inputController.text), | ||
| ), | ||
| ), | ||
| style: const TextStyle(fontSize: 18), | ||
| maxLines: 8, | ||
| minLines: 5, | ||
| controller: inputController, | ||
| onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(), | ||
| ), | ||
| const SizedBox(height: 8), | ||
| Row( | ||
| mainAxisAlignment: MainAxisAlignment.center, | ||
| children: [ | ||
| OutlinedButton( | ||
| onPressed: isProcessing ? null : onPunctuate, | ||
| child: | ||
| Text(isProcessing ? 'Processing...' : 'Punctuate'), | ||
| ), | ||
| const SizedBox(width: 8), | ||
| OutlinedButton( | ||
| onPressed: onClear, | ||
| child: const Text('Clear'), | ||
| ), | ||
| if (onExample != null) ...[ | ||
| const SizedBox(width: 8), | ||
| OutlinedButton( | ||
| onPressed: onExample, | ||
| child: const Text('Example'), | ||
| ), |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Prevent result and input mismatches.
While isProcessing is true, the input remains editable and Clear and Example remain enabled. PunctResult has no request identifier. A response for earlier text can overwrite the result after the user changes or clears the input. Disable all input mutations while a request runs, or add request IDs and discard stale results.
Proposed fix
TextField(
+ readOnly: isProcessing,
decoration: InputDecoration(
@@
OutlinedButton(
- onPressed: onClear,
+ onPressed: isProcessing ? null : onClear,
child: const Text('Clear'),
@@
OutlinedButton(
- onPressed: onExample,
+ onPressed: isProcessing ? null : onExample,
child: const Text('Example'),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| TextField( | |
| decoration: InputDecoration( | |
| border: const OutlineInputBorder(), | |
| hintText: 'Enter text without punctuation', | |
| labelText: 'Input', | |
| contentPadding: | |
| const EdgeInsets.symmetric(horizontal: 12, vertical: 8), | |
| suffixIcon: IconButton( | |
| icon: const Icon(Icons.copy, size: 18), | |
| tooltip: 'Copy input', | |
| onPressed: () => _copyToClipboard(context, inputController.text), | |
| ), | |
| ), | |
| style: const TextStyle(fontSize: 18), | |
| maxLines: 8, | |
| minLines: 5, | |
| controller: inputController, | |
| onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(), | |
| ), | |
| const SizedBox(height: 8), | |
| Row( | |
| mainAxisAlignment: MainAxisAlignment.center, | |
| children: [ | |
| OutlinedButton( | |
| onPressed: isProcessing ? null : onPunctuate, | |
| child: | |
| Text(isProcessing ? 'Processing...' : 'Punctuate'), | |
| ), | |
| const SizedBox(width: 8), | |
| OutlinedButton( | |
| onPressed: onClear, | |
| child: const Text('Clear'), | |
| ), | |
| if (onExample != null) ...[ | |
| const SizedBox(width: 8), | |
| OutlinedButton( | |
| onPressed: onExample, | |
| child: const Text('Example'), | |
| ), | |
| TextField( | |
| readOnly: isProcessing, | |
| decoration: InputDecoration( | |
| border: const OutlineInputBorder(), | |
| hintText: 'Enter text without punctuation', | |
| labelText: 'Input', | |
| contentPadding: | |
| const EdgeInsets.symmetric(horizontal: 12, vertical: 8), | |
| suffixIcon: IconButton( | |
| icon: const Icon(Icons.copy, size: 18), | |
| tooltip: 'Copy input', | |
| onPressed: () => _copyToClipboard(context, inputController.text), | |
| ), | |
| ), | |
| style: const TextStyle(fontSize: 18), | |
| maxLines: 8, | |
| minLines: 5, | |
| controller: inputController, | |
| onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(), | |
| ), | |
| const SizedBox(height: 8), | |
| Row( | |
| mainAxisAlignment: MainAxisAlignment.center, | |
| children: [ | |
| OutlinedButton( | |
| onPressed: isProcessing ? null : onPunctuate, | |
| child: | |
| Text(isProcessing ? 'Processing...' : 'Punctuate'), | |
| ), | |
| const SizedBox(width: 8), | |
| OutlinedButton( | |
| onPressed: isProcessing ? null : onClear, | |
| child: const Text('Clear'), | |
| ), | |
| if (onExample != null) ...[ | |
| const SizedBox(width: 8), | |
| OutlinedButton( | |
| onPressed: isProcessing ? null : onExample, | |
| child: const Text('Example'), | |
| ), |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@flutter-examples/offline-punctuation/lib/punct_controls.dart` around lines 37
- 75, Update the widget controls around the input TextField and the
onClear/onExample buttons so input mutations are disabled while isProcessing is
true: prevent editing the input and disable both Clear and Example, while
preserving the existing Punctuate loading behavior. Ensure the active request
cannot be overwritten by changes made during processing.
| Future<void> init() async { | ||
| if (_state != PunctState.uninitialized) return; | ||
| _state = PunctState.initializing; | ||
|
|
||
| if (kIsWeb) { | ||
| await _initWeb(); | ||
| } else { | ||
| await _initNative(); | ||
| } | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Make init() await ongoing initialization.
When _state is initializing, line 72 returns a completed future. A second punctuation action can then call punctuate() before the worker or SendPort is ready. punctuate() logs an error and drops that request. Store the in-progress initialization future and await it from every caller.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@flutter-examples/offline-punctuation/lib/punct_manager.dart` around lines 71
- 80, Update PunctManager.init() to store the in-progress initialization Future
when transitioning to PunctState.initializing, and have subsequent callers await
that same Future instead of returning immediately. Ensure both _initWeb() and
_initNative() are covered, while preserving the existing initialized fast path
so punctuate() cannot run before setup completes.
| onError: (msg) { | ||
| _state = PunctState.uninitialized; | ||
| _logController.add('Error: $msg'); | ||
| if (!readyCompleter.isCompleted) readyCompleter.completeError(msg); | ||
| }, | ||
| ); | ||
|
|
||
| await _worker!.init(); | ||
| await readyCompleter.future; | ||
| } catch (e) { | ||
| _state = PunctState.uninitialized; | ||
| _logController.add('Error: $e'); | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Publish punctuation failures to the screen and clear processing state.
Worker initialization and runtime failures only update logStream. PunctScreen sets _isProcessing after initialization attempts and only resets it when a result arrives. If model loading or punctuation fails, the Punctuate button stays disabled indefinitely.
flutter-examples/offline-punctuation/lib/punct_manager.dart#L131-L143: Publish web initialization failures through a structured error result or error stream.flutter-examples/offline-punctuation/lib/punct_manager.dart#L176-L181: Publish runtime worker failures through the same structured error path.flutter-examples/offline-punctuation/lib/punct_screen.dart#L54-L75: CheckisInitializedbefore dispatch, and reset_isProcessingwhen the manager reports an error.
📍 Affects 2 files
flutter-examples/offline-punctuation/lib/punct_manager.dart#L131-L143(this comment)flutter-examples/offline-punctuation/lib/punct_manager.dart#L176-L181flutter-examples/offline-punctuation/lib/punct_screen.dart#L54-L75
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@flutter-examples/offline-punctuation/lib/punct_manager.dart` around lines 131
- 143, Publish initialization failures at
flutter-examples/offline-punctuation/lib/punct_manager.dart:131-143 and runtime
worker failures at
flutter-examples/offline-punctuation/lib/punct_manager.dart:176-181 through one
structured error result or error stream, rather than only _logController. In
flutter-examples/offline-punctuation/lib/punct_screen.dart:54-75, check
isInitialized before dispatching punctuation and reset _isProcessing when the
manager reports that error.
| testWidgets('Counter increments smoke test', (WidgetTester tester) async { | ||
| // Build our app and trigger a frame. | ||
| await tester.pumpWidget(const MyApp()); | ||
|
|
||
| // Verify that our counter starts at 0. | ||
| expect(find.text('0'), findsOneWidget); | ||
| expect(find.text('1'), findsNothing); | ||
|
|
||
| // Tap the '+' icon and trigger a frame. | ||
| await tester.tap(find.byIcon(Icons.add)); | ||
| await tester.pump(); | ||
|
|
||
| // Verify that our counter has incremented. | ||
| expect(find.text('0'), findsNothing); | ||
| expect(find.text('1'), findsOneWidget); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Map the application and punctuation-screen widget declarations.
ast-grep outline flutter-examples/offline-punctuation/lib/main.dart --items all
ast-grep outline flutter-examples/offline-punctuation/lib/punct_screen.dart --items all
# Show stable UI labels, buttons, and test keys for a replacement test.
rg -n -C 3 --glob '*.dart' \
"Text\(|TextField\(|ElevatedButton|FilledButton|IconButton|Key\(" \
flutter-examples/offline-punctuation/libRepository: k2-fsa/sherpa-onnx
Length of output: 10246
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Relevant files =="
git ls-files flutter-examples/offline-punctuation/lib flutter-examples/offline-punctuation/test
echo
echo "== main.dart outline =="
ast-grep outline flutter-examples/offline-punctuation/lib/main.dart --view expanded || true
echo
echo "== punct_screen.dart outline =="
ast-grep outline flutter-examples/offline-punctuation/lib/punct_screen.dart --view expanded || true
echo
echo "== punct_controls.dart outline =="
ast-grep outline flutter-examples/offline-punctuation/lib/punct_controls.dart --view expanded || true
echo
echo "== Tests =="
sed -n '1,140p' flutter-examples/offline-punctuation/test/widget_test.dart
echo
echo "== MyApp/class declarations =="
rg -n -C 4 'class MyApp|PunctScreen|PunctControls|Punct|Text\(|findsOneWidget|findsNothing|Icons\.add|OutlinedButton|TextField|Result|Input' flutter-examples/offline-punctuation/libRepository: k2-fsa/sherpa-onnx
Length of output: 50374
Replace the default counter widget test.
The app now renders PunctScreen and InfoScreen; the counter expectations for 0, 1, and Icons.add are stale and do not validate punctuation behavior. Use stable app UI targets such as PunctControls’ Input, Result, and Punctuate labels, or add identifiers for the fields and action.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@flutter-examples/offline-punctuation/test/widget_test.dart` around lines 14 -
28, Replace the default counter test around the testWidgets callback with
coverage for PunctScreen and InfoScreen. Remove the 0/1 text and Icons.add
assertions, and instead locate the stable PunctControls Input, Result, and
Punctuate UI targets to verify the punctuation flow; add field/action
identifiers only if those labels are not sufficient.
| flutter: | ||
| uses-material-design: true |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Bundle the punctuation model assets.
Native model loading copies files from AssetManifest and resolves cnnBiLstm/bpeVocab to $modelDir/$modelFile and $modelDir/$bpeVocab. Since pubspec.yaml has no assets: entries and assets/ contains only .gitkeep, these assets are not bundled and initialization uses missing paths under $modelDir.
Add the model directory to pubspec.yaml and keep generate-asset-list.py synchronized.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@flutter-examples/online-punctuation/pubspec.yaml` around lines 27 - 28, Add
the punctuation model asset directory under the Flutter assets configuration in
pubspec.yaml, and update generate-asset-list.py so its generated asset list
remains synchronized with the bundled model files. Ensure the existing cnnBiLstm
and bpeVocab asset paths resolve from the bundled model directory.
| testWidgets('Counter increments smoke test', (WidgetTester tester) async { | ||
| // Build our app and trigger a frame. | ||
| await tester.pumpWidget(const MyApp()); | ||
|
|
||
| // Verify that our counter starts at 0. | ||
| expect(find.text('0'), findsOneWidget); | ||
| expect(find.text('1'), findsNothing); | ||
|
|
||
| // Tap the '+' icon and trigger a frame. | ||
| await tester.tap(find.byIcon(Icons.add)); | ||
| await tester.pump(); | ||
|
|
||
| // Verify that our counter has incremented. | ||
| expect(find.text('0'), findsNothing); | ||
| expect(find.text('1'), findsOneWidget); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== file list =="
git ls-files | rg '(^|/)flutter-examples/online-punctuation/(pubspec\.yaml|test/widget_test\.dart|lib/)')' || true
echo "== pubspec relevant =="
if [ -f flutter-examples/online-punctuation/pubspec.yaml ]; then
cat -n flutter-examples/online-punctuation/pubspec.yaml
fi
echo "== test relevant =="
if [ -f flutter-examples/online-punctuation/test/widget_test.dart ]; then
cat -n flutter-examples/online-punctuation/test/widget_test.dart
fi
echo "== locate online-punctuation app files =="
fd -p flutter-examples/online-punctuation/lib . | sort | while read -r f; do
echo "--- $f"
cat -n "$f"
done
echo "== search counter/material app terms =="
rg -n "Counter|add|Icons\.add|Online Punctuation|Punctuate|widgets\.test|flutter_test" flutter-examples/online-punctuation || trueRepository: k2-fsa/sherpa-onnx
Length of output: 225
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
import re
path = Path("flutter-examples/online-punctuation/pubspec.yaml")
text = path.read_text()
print("pubspec flutter_test dependency present:", bool(re.search(r'^\s*flutter_test\s*:', text, re.M)))
print("pubspec uses-material-design present:", bool(re.search(r'^\s*uses-material-design:\s*true\s*$', text, re.M)))
print("pubspec dependency keys under dev_dependencies:", sorted(m.group(1) for m in re.finditer(r'^(dev_dependencies):', text, re.M)))
print("pubspec flutter_test exact:", "flutter_test:" in text)
test = Path("flutter-examples/online-punctuation/test/widget_test.dart").read_text() if Path("flutter-examples/online-punctuation/test/widget_test.dart").exists() else ""
print("widget test imports:", [line.strip() for line in test.splitlines() if line.startswith("import")])
print("widget test has byIcon(Icons.add):", "find.byIcon(Icons.add)" in test)
print("widget test has text(0):", "find.text('0')" in test)
print("widget test has text(1):", "find.text('1')" in test)
print("widget test invokes pumpWidget(MyApp):", "tester.pumpWidget(const MyApp())" in test)
PYRepository: k2-fsa/sherpa-onnx
Length of output: 642
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== tracked online-punctuation files =="
git ls-files 'flutter-examples/online-punctuation/*' | sort
echo "== pubspec =="
if [ -f flutter-examples/online-punctuation/pubspec.yaml ]; then
cat -n flutter-examples/online-punctuation/pubspec.yaml
fi
echo "== main/app files =="
for f in $(git ls-files 'flutter-examples/online-punctuation/lib/**' | sort); do
echo "--- $f"
cat -n "$f"
done
echo "== widget test =="
if [ -f flutter-examples/online-punctuation/test/widget_test.dart ]; then
cat -n flutter-examples/online-punctuation/test/widget_test.dart
fi
echo "== relevant symbols =="
rg -n "class MyApp|Online Punctuation|Punctuate|Icons\.add|Counter|find\.text|flutter_test" flutter-examples/online-punctuation || trueRepository: k2-fsa/sherpa-onnx
Length of output: 50374
Replace the copied counter test or update it for the punctuation app.
MyApp builds Home Page, PunctScreen, and InfoScreen, so find.text('0') and find.byIcon(Icons.add) do not match the current UI. Add flutter_test under dev_dependencies if this test is intended to run as part of the package.
📍 Affects 2 files
flutter-examples/online-punctuation/test/widget_test.dart#L14-L28(this comment)flutter-examples/online-punctuation/pubspec.yaml#L27-L28
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@flutter-examples/online-punctuation/test/widget_test.dart` around lines 14 -
28, Replace the copied counter test in MyApp’s widget test with assertions
matching the punctuation app’s Home Page, PunctScreen, or InfoScreen UI,
removing the invalid counter text and add-icon interactions. In
flutter-examples/online-punctuation/pubspec.yaml lines 27-28, add flutter_test
under dev_dependencies if this test remains part of the package.
| unsigned int target_length = ::WideCharToMultiByte( | ||
| CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, | ||
| -1, nullptr, 0, nullptr, nullptr) | ||
| -1; // remove the trailing null character | ||
| int input_length = (int)wcslen(utf16_string); | ||
| std::string utf8_string; | ||
| if (target_length == 0 || target_length > utf8_string.max_size()) { | ||
| return utf8_string; | ||
| } | ||
| utf8_string.resize(target_length); |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== locate utils.cpp =="
fd -a 'utils\.cpp$' . || true
echo "== relevant file excerpt =="
file="$(fd 'utils\.cpp$' . | head -n1 || true)"
if [ -n "${file:-}" ]; then
wc -l "$file"
sed -n '1,120p' "$file" | cat -n
fi
echo "== search for symbol/usage =="
rg -n "Utf8From|WideCharToMultiByte|utf16_string|target_length|input_length" . -S || true
echo "== git diff summary if available =="
git diff --stat || true
git diff -- "$file" | sed -n '1,160p' || true
echo "== read-only behavioral model for unsigned subtraction underflow =="
python3 - <<'PY'
import ctypes
def unsigned_sub(value, sub):
# emulate C++ unsigned int unsigned sub behavior modulo 2**32
return (value - sub) % (2**32)
print("WideCharToMultiByte=0:", unsigned_sub(0, 1))
print("WideCharToMultiByte=1:", unsigned_sub(1, 1))
print("resize argument with bad uint value:", unsigned_sub(0, 1))
PYRepository: k2-fsa/sherpa-onnx
Length of output: 14797
Check WideCharToMultiByte before applying the -1 adjustment.
WideCharToMultiByte returns 0 on failure, but this stores (0U - 1), so target_length becomes UINT_MAX. If that passes utf8_string.max_size(), resize uses a huge size and can abort the runner instead of returning an empty string for invalid surrogate input.
Store the sizing call in a signed variable, return early for 0, then compute required_length - 1.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@flutter-examples/online-punctuation/windows/runner/utils.cpp` around lines 48
- 57, Update the conversion sizing logic near WideCharToMultiByte to store its
result in a signed variable, return the empty string immediately when the sizing
call returns 0, and only then compute target_length as required_length minus
one. Preserve the existing max_size validation before resizing utf8_string.
| /// Load a Flutter asset as bytes. | ||
| static Future<Uint8List> _loadAssetBytes(String assetPath) async { | ||
| final data = await rootBundle.load(assetPath); | ||
| return data.buffer.asUint8List(); | ||
| return data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); | ||
| } |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
_loadAssetBytes returns a view, but the caller passes .buffer to JS.
_loadAssetBytes now correctly returns only the asset range. The caller at Line 83 still uses wasmData.buffer.toJS. ByteBuffer ignores the view offset and length, so the worker can receive the whole underlying bundle buffer instead of the WASM binary. This is the same defect that Line 71 fixes for model files.
Return a compacted copy so .buffer is always exact.
🐛 Proposed fix
/// Load a Flutter asset as bytes.
static Future<Uint8List> _loadAssetBytes(String assetPath) async {
final data = await rootBundle.load(assetPath);
- return data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
+ return Uint8List.fromList(
+ data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes));
}Alternatively, change Line 83 to Uint8List.fromList(wasmData).buffer.toJS.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /// Load a Flutter asset as bytes. | |
| static Future<Uint8List> _loadAssetBytes(String assetPath) async { | |
| final data = await rootBundle.load(assetPath); | |
| return data.buffer.asUint8List(); | |
| return data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); | |
| } | |
| /// Load a Flutter asset as bytes. | |
| static Future<Uint8List> _loadAssetBytes(String assetPath) async { | |
| final data = await rootBundle.load(assetPath); | |
| return Uint8List.fromList( | |
| data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes)); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@flutter-examples/tts/lib/worker_web.dart` around lines 134 - 138, Update
_loadAssetBytes to return a compacted Uint8List copy of the asset range,
ensuring callers using wasmData.buffer.toJS receive only the asset bytes rather
than the underlying buffer. Preserve the existing asset loading and range
selection behavior.
There was a problem hiding this comment.
Pull request overview
Adds Flutter punctuation demos and improves the web/WASM punctuation and build plumbing so the examples can run across desktop/mobile/web using sherpa-onnx.
Changes:
- Added new Flutter example apps for online and offline punctuation (UI, model loading, and platform scaffolding for Android/iOS/macOS/Linux/Windows/web).
- Implemented web (dart:js_interop) support for
OfflinePunctuationand improved worker/asset byte handling for web/WASM flows. - Patched
simple-sentencepiecefor WASM builds by stubbing out threading.
Reviewed changes
Copilot reviewed 192 out of 272 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| wasm/nodejs/sherpa-onnx-punctuation.js | Accept cnnBiLstm (and legacy cnnBilstm) for online punctuation model config. |
| flutter/sherpa_onnx/lib/src/web/tts.dart | Web TTS generation config wiring (incl. reference audio for voice cloning). |
| flutter/sherpa_onnx/lib/src/web/offline_punctuation.dart | Web OfflinePunctuation implementation via JS/WASM interop. |
| flutter-examples/tts/lib/worker_web.dart | Fix asset byte slicing and ArrayBuffer transfer to worker. |
| flutter-examples/online-punctuation/windows/runner/win32_window.h | Windows runner scaffold for the online punctuation example. |
| flutter-examples/online-punctuation/windows/runner/utils.h | Windows runner utilities declarations. |
| flutter-examples/online-punctuation/windows/runner/utils.cpp | Windows runner console/CLI utilities implementation. |
| flutter-examples/online-punctuation/windows/runner/Runner.rc | Windows resources for the online punctuation example. |
| flutter-examples/online-punctuation/windows/runner/runner.exe.manifest | Windows app manifest (DPI awareness, OS compatibility). |
| flutter-examples/online-punctuation/windows/runner/resource.h | Windows resource IDs. |
| flutter-examples/online-punctuation/windows/runner/main.cpp | Windows entrypoint / message loop wiring. |
| flutter-examples/online-punctuation/windows/runner/flutter_window.h | Windows Flutter host window declaration. |
| flutter-examples/online-punctuation/windows/runner/flutter_window.cpp | Windows Flutter host window implementation. |
| flutter-examples/online-punctuation/windows/runner/CMakeLists.txt | Windows runner build rules. |
| flutter-examples/online-punctuation/windows/flutter/CMakeLists.txt | Flutter-managed Windows build rules. |
| flutter-examples/online-punctuation/windows/CMakeLists.txt | Project-level Windows build rules. |
| flutter-examples/online-punctuation/windows/.gitignore | Windows build output ignores. |
| flutter-examples/online-punctuation/web/manifest.json | Web app manifest for the online punctuation example. |
| flutter-examples/online-punctuation/web/index.html | Web bootstrap HTML for the online punctuation example. |
| flutter-examples/online-punctuation/test/widget_test.dart | Widget test scaffold for the online punctuation example. |
| flutter-examples/online-punctuation/README.md | Build/run/model download instructions for the online punctuation example. |
| flutter-examples/online-punctuation/pubspec.yaml | Dependencies and metadata for the online punctuation example. |
| flutter-examples/online-punctuation/macos/RunnerTests/RunnerTests.swift | macOS runner test scaffold. |
| flutter-examples/online-punctuation/macos/Runner/Release.entitlements | macOS release entitlements. |
| flutter-examples/online-punctuation/macos/Runner/MainFlutterWindow.swift | macOS main window wiring. |
| flutter-examples/online-punctuation/macos/Runner/Info.plist | macOS bundle metadata. |
| flutter-examples/online-punctuation/macos/Runner/DebugProfile.entitlements | macOS debug/profile entitlements. |
| flutter-examples/online-punctuation/macos/Runner/Configs/Warnings.xcconfig | macOS warnings config. |
| flutter-examples/online-punctuation/macos/Runner/Configs/Release.xcconfig | macOS release xcconfig include. |
| flutter-examples/online-punctuation/macos/Runner/Configs/Debug.xcconfig | macOS debug xcconfig include. |
| flutter-examples/online-punctuation/macos/Runner/Configs/AppInfo.xcconfig | macOS app name/bundle ID/copyright. |
| flutter-examples/online-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json | macOS icon catalog. |
| flutter-examples/online-punctuation/macos/Runner/AppDelegate.swift | macOS app delegate scaffold. |
| flutter-examples/online-punctuation/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist | macOS workspace checks. |
| flutter-examples/online-punctuation/macos/Runner.xcworkspace/contents.xcworkspacedata | macOS workspace definition. |
| flutter-examples/online-punctuation/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme | macOS scheme. |
| flutter-examples/online-punctuation/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist | macOS project workspace checks. |
| flutter-examples/online-punctuation/macos/Flutter/Flutter-Release.xcconfig | macOS Flutter release include. |
| flutter-examples/online-punctuation/macos/Flutter/Flutter-Debug.xcconfig | macOS Flutter debug include. |
| flutter-examples/online-punctuation/macos/.gitignore | macOS build output ignores. |
| flutter-examples/online-punctuation/linux/runner/my_application.h | Linux runner scaffold header. |
| flutter-examples/online-punctuation/linux/runner/main.cc | Linux runner entrypoint. |
| flutter-examples/online-punctuation/linux/runner/CMakeLists.txt | Linux runner build rules. |
| flutter-examples/online-punctuation/linux/flutter/CMakeLists.txt | Flutter-managed Linux build rules. |
| flutter-examples/online-punctuation/linux/.gitignore | Linux build output ignores. |
| flutter-examples/online-punctuation/lib/worker_web.dart | Web worker controller for online punctuation. |
| flutter-examples/online-punctuation/lib/worker_stub.dart | Non-web worker stub for online punctuation. |
| flutter-examples/online-punctuation/lib/punct_screen.dart | Online punctuation demo screen UI. |
| flutter-examples/online-punctuation/lib/punct_controls.dart | Shared input/result controls UI for punctuation. |
| flutter-examples/online-punctuation/lib/model.dart | Native model asset-to-disk handling for online punctuation. |
| flutter-examples/online-punctuation/lib/model_web.dart | Web model asset loading / config serialization for online punctuation. |
| flutter-examples/online-punctuation/lib/model_config.dart | Online punctuation model selection constants/config. |
| flutter-examples/online-punctuation/ios/RunnerTests/RunnerTests.swift | iOS runner test scaffold. |
| flutter-examples/online-punctuation/ios/Runner/SceneDelegate.swift | iOS scene delegate scaffold. |
| flutter-examples/online-punctuation/ios/Runner/Runner-Bridging-Header.h | iOS bridging header. |
| flutter-examples/online-punctuation/ios/Runner/Info.plist | iOS app metadata. |
| flutter-examples/online-punctuation/ios/Runner/Base.lproj/Main.storyboard | iOS main storyboard scaffold. |
| flutter-examples/online-punctuation/ios/Runner/Base.lproj/LaunchScreen.storyboard | iOS launch screen scaffold. |
| flutter-examples/online-punctuation/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md | iOS launch image docs scaffold. |
| flutter-examples/online-punctuation/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json | iOS launch image catalog. |
| flutter-examples/online-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json | iOS app icon catalog. |
| flutter-examples/online-punctuation/ios/Runner/AppDelegate.swift | iOS app delegate scaffold. |
| flutter-examples/online-punctuation/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings | iOS workspace settings. |
| flutter-examples/online-punctuation/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist | iOS workspace checks. |
| flutter-examples/online-punctuation/ios/Runner.xcworkspace/contents.xcworkspacedata | iOS workspace definition. |
| flutter-examples/online-punctuation/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme | iOS scheme. |
| flutter-examples/online-punctuation/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings | iOS project workspace settings. |
| flutter-examples/online-punctuation/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist | iOS project workspace checks. |
| flutter-examples/online-punctuation/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata | iOS project workspace definition. |
| flutter-examples/online-punctuation/ios/Flutter/Release.xcconfig | iOS Flutter release include. |
| flutter-examples/online-punctuation/ios/Flutter/Debug.xcconfig | iOS Flutter debug include. |
| flutter-examples/online-punctuation/ios/Flutter/AppFrameworkInfo.plist | iOS Flutter framework plist scaffold. |
| flutter-examples/online-punctuation/ios/.gitignore | iOS build output ignores. |
| flutter-examples/online-punctuation/assets/.gitkeep | Placeholder to keep assets dir in VCS. |
| flutter-examples/online-punctuation/android/settings.gradle.kts | Android Gradle settings for online punctuation example. |
| flutter-examples/online-punctuation/android/gradle/wrapper/gradle-wrapper.properties | Gradle wrapper version for example. |
| flutter-examples/online-punctuation/android/gradle.properties | Android gradle properties for example. |
| flutter-examples/online-punctuation/android/build.gradle.kts | Top-level Android build config for example. |
| flutter-examples/online-punctuation/android/app/src/profile/AndroidManifest.xml | Android profile manifest. |
| flutter-examples/online-punctuation/android/app/src/main/res/values/styles.xml | Android styles (light). |
| flutter-examples/online-punctuation/android/app/src/main/res/values-night/styles.xml | Android styles (dark). |
| flutter-examples/online-punctuation/android/app/src/main/res/drawable/launch_background.xml | Android launch background. |
| flutter-examples/online-punctuation/android/app/src/main/res/drawable-v21/launch_background.xml | Android v21 launch background. |
| flutter-examples/online-punctuation/android/app/src/main/kotlin/com/example/online_punctuation/MainActivity.kt | Android main activity scaffold. |
| flutter-examples/online-punctuation/android/app/src/main/AndroidManifest.xml | Android main manifest. |
| flutter-examples/online-punctuation/android/app/src/debug/AndroidManifest.xml | Android debug manifest. |
| flutter-examples/online-punctuation/android/app/build.gradle.kts | Android app module build config. |
| flutter-examples/online-punctuation/android/.gitignore | Android build output ignores. |
| flutter-examples/online-punctuation/analysis_options.yaml | Analyzer/lints config. |
| flutter-examples/online-punctuation/.metadata | Flutter tool metadata. |
| flutter-examples/online-punctuation/.gitignore | Example-level ignores. |
| flutter-examples/offline-punctuation/windows/runner/win32_window.h | Windows runner scaffold for the offline punctuation example. |
| flutter-examples/offline-punctuation/windows/runner/utils.h | Windows runner utilities declarations. |
| flutter-examples/offline-punctuation/windows/runner/utils.cpp | Windows runner console/CLI utilities implementation. |
| flutter-examples/offline-punctuation/windows/runner/Runner.rc | Windows resources for the offline punctuation example. |
| flutter-examples/offline-punctuation/windows/runner/runner.exe.manifest | Windows app manifest (DPI awareness, OS compatibility). |
| flutter-examples/offline-punctuation/windows/runner/resource.h | Windows resource IDs. |
| flutter-examples/offline-punctuation/windows/runner/main.cpp | Windows entrypoint / message loop wiring. |
| flutter-examples/offline-punctuation/windows/runner/flutter_window.h | Windows Flutter host window declaration. |
| flutter-examples/offline-punctuation/windows/runner/flutter_window.cpp | Windows Flutter host window implementation. |
| flutter-examples/offline-punctuation/windows/runner/CMakeLists.txt | Windows runner build rules. |
| flutter-examples/offline-punctuation/windows/flutter/CMakeLists.txt | Flutter-managed Windows build rules. |
| flutter-examples/offline-punctuation/windows/CMakeLists.txt | Project-level Windows build rules. |
| flutter-examples/offline-punctuation/windows/.gitignore | Windows build output ignores. |
| flutter-examples/offline-punctuation/web/manifest.json | Web app manifest for the offline punctuation example. |
| flutter-examples/offline-punctuation/web/index.html | Web bootstrap HTML for the offline punctuation example. |
| flutter-examples/offline-punctuation/test/widget_test.dart | Widget test scaffold for the offline punctuation example. |
| flutter-examples/offline-punctuation/README.md | Build/run/model download instructions for the offline punctuation example. |
| flutter-examples/offline-punctuation/pubspec.yaml | Dependencies and metadata for the offline punctuation example. |
| flutter-examples/offline-punctuation/macos/RunnerTests/RunnerTests.swift | macOS runner test scaffold. |
| flutter-examples/offline-punctuation/macos/Runner/Release.entitlements | macOS release entitlements. |
| flutter-examples/offline-punctuation/macos/Runner/MainFlutterWindow.swift | macOS main window wiring. |
| flutter-examples/offline-punctuation/macos/Runner/Info.plist | macOS bundle metadata. |
| flutter-examples/offline-punctuation/macos/Runner/DebugProfile.entitlements | macOS debug/profile entitlements. |
| flutter-examples/offline-punctuation/macos/Runner/Configs/Warnings.xcconfig | macOS warnings config. |
| flutter-examples/offline-punctuation/macos/Runner/Configs/Release.xcconfig | macOS release xcconfig include. |
| flutter-examples/offline-punctuation/macos/Runner/Configs/Debug.xcconfig | macOS debug xcconfig include. |
| flutter-examples/offline-punctuation/macos/Runner/Configs/AppInfo.xcconfig | macOS app name/bundle ID/copyright. |
| flutter-examples/offline-punctuation/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json | macOS icon catalog. |
| flutter-examples/offline-punctuation/macos/Runner/AppDelegate.swift | macOS app delegate scaffold. |
| flutter-examples/offline-punctuation/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist | macOS workspace checks. |
| flutter-examples/offline-punctuation/macos/Runner.xcworkspace/contents.xcworkspacedata | macOS workspace definition. |
| flutter-examples/offline-punctuation/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme | macOS scheme. |
| flutter-examples/offline-punctuation/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist | macOS project workspace checks. |
| flutter-examples/offline-punctuation/macos/Flutter/Flutter-Release.xcconfig | macOS Flutter release include. |
| flutter-examples/offline-punctuation/macos/Flutter/Flutter-Debug.xcconfig | macOS Flutter debug include. |
| flutter-examples/offline-punctuation/macos/.gitignore | macOS build output ignores. |
| flutter-examples/offline-punctuation/linux/runner/my_application.h | Linux runner scaffold header. |
| flutter-examples/offline-punctuation/linux/runner/main.cc | Linux runner entrypoint. |
| flutter-examples/offline-punctuation/linux/runner/CMakeLists.txt | Linux runner build rules. |
| flutter-examples/offline-punctuation/linux/flutter/CMakeLists.txt | Flutter-managed Linux build rules. |
| flutter-examples/offline-punctuation/linux/.gitignore | Linux build output ignores. |
| flutter-examples/offline-punctuation/lib/worker_web.dart | Web worker controller for offline punctuation. |
| flutter-examples/offline-punctuation/lib/worker_stub.dart | Non-web worker stub for offline punctuation. |
| flutter-examples/offline-punctuation/lib/punct_screen.dart | Offline punctuation demo screen UI. |
| flutter-examples/offline-punctuation/lib/punct_controls.dart | Shared input/result controls UI for punctuation. |
| flutter-examples/offline-punctuation/lib/model.dart | Native model asset-to-disk handling for offline punctuation. |
| flutter-examples/offline-punctuation/lib/model_web.dart | Web model asset loading / config serialization for offline punctuation. |
| flutter-examples/offline-punctuation/lib/model_config.dart | Offline punctuation model selection constants/config. |
| flutter-examples/offline-punctuation/ios/RunnerTests/RunnerTests.swift | iOS runner test scaffold. |
| flutter-examples/offline-punctuation/ios/Runner/SceneDelegate.swift | iOS scene delegate scaffold. |
| flutter-examples/offline-punctuation/ios/Runner/Runner-Bridging-Header.h | iOS bridging header. |
| flutter-examples/offline-punctuation/ios/Runner/Info.plist | iOS app metadata. |
| flutter-examples/offline-punctuation/ios/Runner/Base.lproj/Main.storyboard | iOS main storyboard scaffold. |
| flutter-examples/offline-punctuation/ios/Runner/Base.lproj/LaunchScreen.storyboard | iOS launch screen scaffold. |
| flutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md | iOS launch image docs scaffold. |
| flutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json | iOS launch image catalog. |
| flutter-examples/offline-punctuation/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json | iOS app icon catalog. |
| flutter-examples/offline-punctuation/ios/Runner/AppDelegate.swift | iOS app delegate scaffold. |
| flutter-examples/offline-punctuation/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings | iOS workspace settings. |
| flutter-examples/offline-punctuation/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist | iOS workspace checks. |
| flutter-examples/offline-punctuation/ios/Runner.xcworkspace/contents.xcworkspacedata | iOS workspace definition. |
| flutter-examples/offline-punctuation/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme | iOS scheme. |
| flutter-examples/offline-punctuation/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings | iOS project workspace settings. |
| flutter-examples/offline-punctuation/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist | iOS project workspace checks. |
| flutter-examples/offline-punctuation/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata | iOS project workspace definition. |
| flutter-examples/offline-punctuation/ios/Flutter/Release.xcconfig | iOS Flutter release include. |
| flutter-examples/offline-punctuation/ios/Flutter/Debug.xcconfig | iOS Flutter debug include. |
| flutter-examples/offline-punctuation/ios/Flutter/AppFrameworkInfo.plist | iOS Flutter framework plist scaffold. |
| flutter-examples/offline-punctuation/ios/.gitignore | iOS build output ignores. |
| flutter-examples/offline-punctuation/assets/.gitkeep | Placeholder to keep assets dir in VCS. |
| flutter-examples/offline-punctuation/android/settings.gradle.kts | Android Gradle settings for offline punctuation example. |
| flutter-examples/offline-punctuation/android/gradle/wrapper/gradle-wrapper.properties | Gradle wrapper version for example. |
| flutter-examples/offline-punctuation/android/gradle.properties | Android gradle properties for example. |
| flutter-examples/offline-punctuation/android/build.gradle.kts | Top-level Android build config for example. |
| flutter-examples/offline-punctuation/android/app/src/profile/AndroidManifest.xml | Android profile manifest. |
| flutter-examples/offline-punctuation/android/app/src/main/res/values/styles.xml | Android styles (light). |
| flutter-examples/offline-punctuation/android/app/src/main/res/values-night/styles.xml | Android styles (dark). |
| flutter-examples/offline-punctuation/android/app/src/main/res/drawable/launch_background.xml | Android launch background. |
| flutter-examples/offline-punctuation/android/app/src/main/res/drawable-v21/launch_background.xml | Android v21 launch background. |
| flutter-examples/offline-punctuation/android/app/src/main/kotlin/com/example/offline_punctuation/MainActivity.kt | Android main activity scaffold. |
| flutter-examples/offline-punctuation/android/app/src/main/AndroidManifest.xml | Android main manifest. |
| flutter-examples/offline-punctuation/android/app/src/debug/AndroidManifest.xml | Android debug manifest. |
| flutter-examples/offline-punctuation/android/app/build.gradle.kts | Android app module build config. |
| flutter-examples/offline-punctuation/android/.gitignore | Android build output ignores. |
| flutter-examples/offline-punctuation/analysis_options.yaml | Analyzer/lints config. |
| flutter-examples/offline-punctuation/.metadata | Flutter tool metadata. |
| flutter-examples/offline-punctuation/.gitignore | Example-level ignores. |
| cmake/simple-sentencepiece.cmake | WASM build patching to stub out sentencepiece threading. |
Files not reviewed (6)
- flutter-examples/offline-punctuation/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: Generated file
- flutter-examples/offline-punctuation/ios/Runner.xcworkspace/contents.xcworkspacedata: Generated file
- flutter-examples/offline-punctuation/macos/Runner.xcworkspace/contents.xcworkspacedata: Generated file
- flutter-examples/online-punctuation/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: Generated file
- flutter-examples/online-punctuation/ios/Runner.xcworkspace/contents.xcworkspacedata: Generated file
- flutter-examples/online-punctuation/macos/Runner.xcworkspace/contents.xcworkspacedata: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| testWidgets('Counter increments smoke test', (WidgetTester tester) async { | ||
| // Build our app and trigger a frame. | ||
| await tester.pumpWidget(const MyApp()); | ||
|
|
||
| // Verify that our counter starts at 0. | ||
| expect(find.text('0'), findsOneWidget); | ||
| expect(find.text('1'), findsNothing); | ||
|
|
||
| // Tap the '+' icon and trigger a frame. | ||
| await tester.tap(find.byIcon(Icons.add)); | ||
| await tester.pump(); | ||
|
|
||
| // Verify that our counter has incremented. | ||
| expect(find.text('0'), findsNothing); | ||
| expect(find.text('1'), findsOneWidget); | ||
| }); |
| import 'package:flutter/foundation.dart' show kIsWeb; | ||
| import 'package:flutter/material.dart'; |
| testWidgets('Counter increments smoke test', (WidgetTester tester) async { | ||
| // Build our app and trigger a frame. | ||
| await tester.pumpWidget(const MyApp()); | ||
|
|
||
| // Verify that our counter starts at 0. | ||
| expect(find.text('0'), findsOneWidget); | ||
| expect(find.text('1'), findsNothing); | ||
|
|
||
| // Tap the '+' icon and trigger a frame. | ||
| await tester.tap(find.byIcon(Icons.add)); | ||
| await tester.pump(); | ||
|
|
||
| // Verify that our counter has incremented. | ||
| expect(find.text('0'), findsNothing); | ||
| expect(find.text('1'), findsOneWidget); | ||
| }); |
| import 'package:flutter/foundation.dart' show kIsWeb; | ||
| import 'package:flutter/material.dart'; |
| if (freopen_s(&unused, "CONOUT$", "w", stdout)) { | ||
| _dup2(_fileno(stdout), 1); | ||
| } | ||
| if (freopen_s(&unused, "CONOUT$", "w", stderr)) { | ||
| _dup2(_fileno(stdout), 2); | ||
| } |
| if (freopen_s(&unused, "CONOUT$", "w", stdout)) { | ||
| _dup2(_fileno(stdout), 1); | ||
| } | ||
| if (freopen_s(&unused, "CONOUT$", "w", stderr)) { | ||
| _dup2(_fileno(stdout), 2); | ||
| } |
| #include <functional> | ||
| #include <future> | ||
| #include <memory> | ||
| #include <vector> | ||
|
|
||
| class ThreadPool { | ||
| public: | ||
| ThreadPool(size_t) {} | ||
| template<class F, class... Args> | ||
| std::future<typename std::result_of<F(Args...)>::type> | ||
| enqueue(F&& f, Args&&... args) { | ||
| // Run synchronously — no threading in WASM. | ||
| using return_type = typename std::result_of<F(Args...)>::type; | ||
| auto task = std::make_shared<std::packaged_task<return_type()>>( | ||
| std::bind(std::forward<F>(f), std::forward<Args>(args)...)); | ||
| std::future<return_type> res = task->get_future(); | ||
| (*task)(); | ||
| return res; | ||
| } | ||
| }; |
| // Reference audio for voice cloning (e.g. Pocket TTS). | ||
| if (config.referenceAudio != null && config.referenceAudio!.isNotEmpty) { | ||
| genConfig['referenceAudio'] = config.referenceAudio; | ||
| genConfig['referenceAudio'] = config.referenceAudio as JSAny; |
There was a problem hiding this comment.
♻️ Duplicate comments (1)
flutter/sherpa_onnx/lib/src/web/tts.dart (1)
83-88: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winPreserve the
Float32Listview range.
config.referenceAudio!.buffer.toJSexposes the whole backing buffer. A validFloat32Listcan be a view with an offset or a shorter length, so this can pass unrelated samples to the Web wrapper. Use the list-levelFloat32List.toJSconversion, or pass the view byte offset and length toFloat32Array.Proposed fix
- // Convert Float32List to a JS Float32Array via the ArrayBuffer constructor. - final arrayBuffer = config.referenceAudio!.buffer.toJS; - final float32ArrayCtor = - globalContext.getProperty('Float32Array'.toJS) as JSFunction; - genConfig['referenceAudio'] = - float32ArrayCtor.callAsConstructor(arrayBuffer); + genConfig['referenceAudio'] = config.referenceAudio!.toJS;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@flutter/sherpa_onnx/lib/src/web/tts.dart` around lines 83 - 88, Update the reference-audio conversion in the surrounding TTS configuration flow to preserve the Float32List view’s offset and length: use config.referenceAudio!.toJS directly, or construct the JavaScript Float32Array with the view’s byte offset and byte length instead of the entire buffer. Keep the resulting value assigned to genConfig['referenceAudio'].Source: MCP tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@flutter/sherpa_onnx/lib/src/web/tts.dart`:
- Around line 83-88: Update the reference-audio conversion in the surrounding
TTS configuration flow to preserve the Float32List view’s offset and length: use
config.referenceAudio!.toJS directly, or construct the JavaScript Float32Array
with the view’s byte offset and byte length instead of the entire buffer. Keep
the resulting value assigned to genConfig['referenceAudio'].
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 5c26ad85-0330-4cb5-912e-6768c587ef7e
📒 Files selected for processing (5)
cmake/simple-sentencepiece.cmakeflutter-examples/offline-punctuation/lib/punct_screen.dartflutter-examples/online-punctuation/lib/punct_screen.dartflutter-examples/tts/test/widget_test.dartflutter/sherpa_onnx/lib/src/web/tts.dart
💤 Files with no reviewable changes (3)
- flutter-examples/tts/test/widget_test.dart
- flutter-examples/offline-punctuation/lib/punct_screen.dart
- flutter-examples/online-punctuation/lib/punct_screen.dart
🚧 Files skipped from review as they are similar to previous changes (1)
- cmake/simple-sentencepiece.cmake
Summary by CodeRabbit