V- Modal AI: Visual Video / Image Search - Flutter Video SDK
Dart android-sdkflutterflutter-appflutter-packageflutter-sdkflutter-videoflutter-video-editingflutter-video-playerflutter-video-sdkflutter-videosflutter-videosdkmobile-videomobile-video-editor-sdkmobile-video-sdkvideo-editingvideo-sdkvideo-searchvideo-search-enginevideo-streaming
Release Flutter SDK from 5136d84a8a03e066a099f1b0c4c455deb4e2c1b7
vmodal-release-app322321b41d0d
diff --git a/README.md b/README.mdindex b6cde0e..858a158 100644--- a/README.md+++ b/README.md@@ -158,7 +158,7 @@ Minimum toolchain: Flutter `3.44.0` and Dart `3.12.0`.```bashgit clone https://github.com/v-modal/vmodal_sdk_flutter.gitcd vmodal_sdk_flutter-bash install.sh+bash install.sh installbash test.sh all```diff --git a/RELEASE_METADATA b/RELEASE_METADATAindex b357b2c..5149bb0 100644--- a/RELEASE_METADATA+++ b/RELEASE_METADATA@@ -1 +1 @@-Source-vmx-api: c70f5dea01b2dd1729aba442c739f3ed3f331c23+Source-vmx-api: 5136d84a8a03e066a099f1b0c4c455deb4e2c1b7diff --git a/SOURCE_MANIFEST.sha256 b/SOURCE_MANIFEST.sha256index 6427680..be4591b 100644--- a/SOURCE_MANIFEST.sha256+++ b/SOURCE_MANIFEST.sha256@@ -1,25 +1,23 @@002abcc5d95c0cf20375adefe4ee2472581a615e64f5726bf361dd5c679cdea7 test/auth_http_test.dart008655dc4707449090b05556247f12e3f210bae227e1dc62b1e28c40a2c3c537 test/resources_models_test.dart+00abc247751b8e899e28bf2a33c003ebebba8a5241689c10f4d321d1f1a20540 RELEASE_METADATA+031d62a7749209b887086adceff8ce666bf81e5f9bda2775fb4d650f901d08c1 example/test/widget_test.dart05a8215a0f8d4d5ca26d8dfdf93d8c41b5785d84855459f979b079527f6232b3 lib/src/api_key_provider.dart-07675cf3fed7bf35703aac4c14e67157d7eb57d8a52ea2e523acb1b711e30873 README.md+09a850ca6ebd5470138b7f20204d4dbe0fec89d268a205f14cf3bff0b99f365b build.sh0a1394c90829b91541aa01e9786e3195aae04fc49a7b92775dbf404bf2802107 test/fakes_test.dart-0f82b18017fba6bb5ce3aa4b2d1a00c9382fc8aae7b1d9326e44b18abd66d80b example/android/gradle.properties-119668af3446819daa6f8aa55b6e9c2160dda70241628709f6f1f14836f4aff9 example/pubspec.lock11b247bc6796892d67c9a821d18604db4dd6a880981b34f38460b9866e6b247f example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings11b247bc6796892d67c9a821d18604db4dd6a880981b34f38460b9866e6b247f example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings13bacc486006b6b6ae11ae37b2cda0dddf588b8aa8e72c1b13e570b95f36aa59 doc/sdk_contract.md14368b598ece0ce9b2e249148a10a92f2c80e38427c077013a1515826f4365bd test/fixtures/routes_contract.json-186338d323ff6ab6c33939579cdb2a67a6a0222dc6966ddae8ee4641a5abc219 example/README.md+1886337e99c5c47473d3f14df9941d7c932321d789c6f6a5af412e6a384ad009 example/README.md19be171481dc71a0b2803ebcd01dd8b0c5fd5778dee34c0a3cabc948c225f24e example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]19be171481dc71a0b2803ebcd01dd8b0c5fd5778dee34c0a3cabc948c225f24e example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]1a8d11d01d1cc92c650c9c9ed35299240052d4683a15a719a2315ef44185e074 example/ios/Runner/Runner-Bridging-Header.h2261aee252795421960040a611bdda5cc86fe649411b13391e62a86e9d73a4f3 example/ios/Runner.xcodeproj/project.pbxproj23756b83470b1f25f6a7e6b5a6270f123a5224e49fd8e2eda36001358951b688 install.sh28315361fb94de58b44de0e303fab5271aec59c752a8c36ec76fd66c806bfc59 CHANGELOG.md-28960838bdddfa72b39ce7e86a23d547d5e5ec755498249af966d3733605dacc build.sh28c321f8798c0e803246c737e0b634c5f3ade930239bb6e5429098bb2b096d86 doc/manage_api_key.md28f1ad1be044eb3fbee9a9435c4905a8296ba1ded9a9508fda5436f0de7b93bf lib/src/routes.dart-2a8d9374364cb4bae0583bbc8f27a178258f5c6298722353716829e30ec11e19 RELEASE_METADATA2ad9b4183bce96eacd91c5514de9231b1f0a4f269392726e174507cfa507981a lib/src/http.dart2b969fbd1d82d89a5dc7822032ce9fe0df4bda625da969bc8e93c57e43fcf2c2 pubspec.yaml2eaee2d6e00f6085ad65d7ff63a20963e78b635cb3d41eb15be4f37f55430295 example/asset/video_10frames.mp4@@ -29,12 +27,14 @@318ca9f582d3a74cbee346857d2df1b50a2deeb7fb687ab64eeeddd037157b3e example/ios/Runner/Info.plist3221993eac1057198d652b7437105e2953ca4850d415eb0eb2b9625874fd059e example/android/gradle/wrapper/gradle-wrapper.properties37b7148216ac6090e36adfb699d642b8dd1e1b8ba99870e65e88733947a59fa6 LICENSE+37e41b32944b2969165f891409dff50a491f154a2be091a842b27f7da79bea2b example/lib/main.dart+39a60e405c807abeec1a44ecc3aaee029d91ea4643bef463ed8293d8e0e5eb87 test/workflow_layout_test.dart3b1e214f466ffedff74baa5598ad5c4421130eea6bc8d57b8fe23435e8280ae4 example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json3c34e1f298d0c9ea3455d46db6b7759c8211a49e9ec6e44b635fc5c87dfb4180 example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png406de1350b79662fcaf007cb0cacd7a6b71b83815dc7cd3c7b561fcfba5600a3 tool/check_route_sync.dart41c7d42f6e61f8fe7f30b1ffa2256aecbc9682be06d18c4a3062043e1a2e547c example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]4209a49e44a92ec40a327d3455eb1b1c153ee83d75de1c2be0a12ab18b2ff9de example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]-42c8c75e3384d7d93a3319c6b50ed2f74e3862e7c5ce45757d8165f8f656ae9a test/workflow_layout_test.dart+42a222e5112523a5bce0752a2b6392ee18f8684c739918b6382145d398bb1e80 example/android/settings.gradle.kts451c6d9ba0a2b3ff43092ea349c60fa79a91f1158b915eb29dbdd357cb95d7b8 example/ios/Runner/AppDelegate.swift4630bdec004652eae39bd30f1e864a5b6e5f27a7d98f866bdea192b4d65b4046 lib/src/adaptive_upload.dart46c3c9702ff7c5584e11c954d943cfb6e07fb26e3fbd072ddbc0f388aa352de1 example/ios/Runner.xcworkspace/contents.xcworkspacedata@@ -67,7 +67,6 @@93ae7d494fad0fb30cbf3ae746a39c4bc7a0f8bbf87fbb587a3f3c01f3c5ce20 example/ios/Runner/Assets.xcassets/LaunchImage.imageset/[email protected]94433756fe10005ddd6fc55cc5c0b1e9f3c10b66a08ceac795ece6713d34e28a example/android/app/src/main/res/drawable/launch_background.xml970aad998c7e3d34430ff59c72aa224e60155f85038efa7ffc6fdf73b531437a test/regression_manifest_test.dart-9e974714fa0e673a84f9bf6ead3a96bfd53b99063ee4f8cb5bbc6451238998b5 example/lib/main.dart9fbce429f56243561dd437a527136c9f9ed77165e3b271b923faf236cfcd0484 example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcschemea3134f6fc8387589e96a345ea35d4c68240c7c1893ef5cd5926707e4168e5309 lib/src/transport.darta80b38547f5d9ca1874f60e71c648e3fc12ab5f7cb88d1bead6d5b863d3c0245 readme_assets/dev_homepage.jpg@@ -75,13 +74,11 @@ a82d7765b37116ee4821d2cd1d65942febf8032353757ffb0826eabde785b4a6 example/ios/Fla82d7765b37116ee4821d2cd1d65942febf8032353757ffb0826eabde785b4a6 example/ios/Flutter/Release.xcconfiga985b626c4f7546a8ba392d135e9226c3547c8e2b46895f5f2bdf40d7b14ef9f example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.mda9b21eb6f4271385655a8771f76e29eef8c1107d7879cbcfc567e6619d1f716a example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]-ac2de3201a4c310b8e56e07317b67f841f177cb31279a67e9af2508caab90676 test/shell_scripts_test.dart-adc9bfd3287fdde7af102586342b16bb0da7ca0548b976972af46d13bad19de7 example/test/widget_test.dartadd68b905971dedfcc0d0b5b7118030de5925ba8c081ad9815463699e3a444ad example/ios/Runner/SceneDelegate.swiftaf86f6d0d7c5f10f0df759b04790d0b0f495446916ce121b3ef68e4d86d4fd8a lib/src/client.dart+b17d54b5038c909311e45c811b288e3506e3c6b7d4bc29d3e65c56e357178c1f README.mdb1d3b70a6c9ecde707a9f139a3e7c5a2b4db808e9746db6ac6195c2205c9522e test/fakes.dartb2dc1cfc58dcd93d62c8f4a1c05210c9f4a3e5b93e69541a40fcf8176cb5f2aa .pubignore-b76d554153a63772dddbe2ee91abdf582f5f871af40698b80a2ef7b70903d96f example/android/settings.gradle.ktsb8013ee0b123493f6277937c99ea4432063162a4167d99d5356647738261b7c1 example/android/app/src/main/AndroidManifest.xmlb9ad02cf6576a04d1b6806ac02a2431481b448dd0c2e505ce25842d1f7c4730b example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]b9ad02cf6576a04d1b6806ac02a2431481b448dd0c2e505ce25842d1f7c4730b example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]@@ -89,14 +86,16 @@ ba941377f1ee717091dd30522609d028f32cd60df575564c75ab0228c2543d35 test/config_robe59599b9ba77d031e9b4bad7f8d5c59efd2687888c5b73be4fbea115902106b test/adaptive_upload_test.dartc13557f89597f0be73f48dc8463aa7513e9e814c0e6a0ab871e441834687abb1 test/upload_test.dartc56419d129059b64551e06f074e88ef62676f25938dc2a1fe28a6ab3f2ba8547 readme_assets/logo_vmodal_owl.jpeg-c5798c4db716557be44b294ba1d56160c8b36e11511325cf089af0d21df8a96f example/pubspec.yaml+c59d35f6e3b82291eff92d5c7d55d9efb18ef2375cdef091c282282930729cad example/pubspec.lockc5ce516b547327aab5b6fa27a523d4c76e66294ada3248b293c54b9595cd3a87 example/.metadatac6e6d3b215ae744a9c391f4c4d44157eff5e739d6ad6c39f9bfa5df66dddd267 example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]c7c0c0189145e4e32a401c61c9bdc615754b0264e7afae24e834bb81049eaf81 example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png+ca703ea63f5117dea4c308af57be8ff3a65e95400862159b7e793a90dc4d3200 example/pubspec.yamlcab10a0d391ec5bc09ef50ce49e8ad401cee7ef03707ec0923a222c5c2b3d212 example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]cafa2529768e48a6b89f85a069e337eff7a5cf75103d6ac8623bdbb7a1088549 lib/src/collection_uploads.dartccc7950fd5f5b82067c85f667940a9d59189151460761ece8098ca78daa19469 example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.jsoncf9402a50d0b10a4a1002fa7aeef3b98c0f12e7638dd8cb3acd26d286bd66914 tool/release_manifest.dart+cfff9cdf89ea54b00de5fc13eba57e8aeef785a0a53b892c77be41772531ae7f example/android/gradle.propertiesd09f68c36895c2550a6b78d378b0ca1d533b16ae12ead55f3d6dbcfb9997996f lib/src/models.dartd2411f67f427c095c7d82718c23ddd114fa39221e43333bfd55ac8ece9e4c877 lib/src/upload.dartd31d6bb36542a9022c62d2d9940b0efd07f60b1cdfb30e35f8be8b15a226c843 run.sh@@ -116,3 +115,4 @@ fbbda2e7e29bbd860539a9ca18c478f3b02de140f25a872c19a6dbecd11bc94b .github/workflfcef63e72b69415a1090c376095f8f44977e26104ffaeccf3a82430f65dcd4ff lib/src/errors.dartfd2bad0ad87fbf2f15f7e9845b830db58408bb4c502c6ff105f39e4e7cce1905 test/multipart_upload_test.dartfd367b6c43006d61b730f674970dd48b9f662c8f2264e52ffc1558102a2c9f2d example/ios/Runner/Base.lproj/Main.storyboard+fdff04bb5b384271443aad9f2b5b1a3c8c2f40ca56bdf75661cdef965ebcb347 test/shell_scripts_test.dartdiff --git a/build.sh b/build.shindex d3ed617..18aaf5d 100755--- a/build.sh+++ b/build.sh@@ -115,7 +115,14 @@ sdk_clean() {## Usage:bash build.sh clean'- [[ "$PWD" == */uinterface/sdk_flutter ]] || { echo 'Refusing to clean outside sdk_flutter.' >&2; return 2; }+ [[ -f "$sdk_dir/pubspec.yaml" && -f "$sdk_dir/example/pubspec.yaml" ]] || {+ echo 'Refusing to clean outside the VModal Flutter SDK.' >&2+ return 2+ }+ grep -q '^name: vmodal_sdk_flutter$' "$sdk_dir/pubspec.yaml" || {+ echo 'Refusing to clean an unexpected Flutter package.' >&2+ return 2+ }sdk_flutter clean(cd example && sdk_flutter clean)}diff --git a/example/README.md b/example/README.mdindex b9d7118..6d6c14c 100644--- a/example/README.md+++ b/example/README.md@@ -1,12 +1,14 @@# VModal Flutter example-This small application shows the basic VModal SDK workflow on Android or iOS:+This application shows a complete VModal SDK evaluation workflow on Android or+iOS:1. Create a client with a runtime API key.2. Confirm which user is authenticated.-3. Search videos with a natural-language query.-4. Upload the bundled 10-frame sample video while displaying progress.-5. Cancel an upload if needed.+3. Choose a video or use the bundled 10-frame sample.+4. Upload it while displaying progress and cancellation.+5. Create an image index and refresh its job state.+6. Search the indexed collection and inspect result fields.The example is intentionally simple. It keeps all UI and SDK calls in[`lib/main.dart`](lib/main.dart), so a beginner can follow the complete flow in@@ -173,24 +175,7 @@ A successful request displays the authenticated user type. If you receive anSDK error instead, check that the key is valid, has not expired, and belongs tothe intended VModal environment.-## 8. Run a search--1. Leave the default query, `red bicycle`, or enter your own description.-2. Tap **Search**.-3. Read the result count in the status area.--The example sends:--```dart-final result = await client.searches.searchVideo(- SearchRequest(queryText: query),-);-```--A result count of zero is still a successful request; it only means the user's-current video collection has no matching items.--## 9. Upload the bundled sample video+## 8. Choose and upload a videoThe repository includes[`asset/video_10frames.mp4`](asset/video_10frames.mp4), a one-second, 320 × 240@@ -203,7 +188,7 @@ file's absolute path. This copy is necessary because the upload SDK accepts a`File`, while a bundled Flutter asset is not directly exposed as a normalmobile file.-To try it:+To use the bundled sample:1. Wait until the status says **Bundled 10-frame sample video is ready.**2. Configure the client if you have not already done so.@@ -220,14 +205,11 @@ collection: flutter_examplesub-collection: astream```-To upload your own video instead, replace the pre-filled value with an absolute-path returned by a file picker, camera flow, downloaded file, or app-owned-documents/cache directory. A path on your computer is normally not valid-inside an Android emulator, Android phone, iOS simulator, or iPhone. The mobile-app must be able to read the file in its own environment.--This example does not include a file-picker package because file picking-belongs to the parent application.+To upload your own video, tap **Choose video**. Flutter's `file_selector`+adapter opens the Android or iOS native picker and places its app-readable path+in the path field. Canceling the picker leaves the current sample selected. A+path on your computer is normally not valid inside a phone or emulator; use+the picker, bundled asset, camera flow, download, or app-owned directory.In a real application, pass the path returned by your chosen picker or cameraadapter to:@@ -244,7 +226,61 @@ The SDK streams the file instead of loading the complete video into memory.`task.progress` reports upload progress, `task.result` completes with theserver response, and `task.cancel()` cancels the operation.-## 10. Stop and clean up+## 9. Create and monitor the image index++After upload succeeds:++1. Tap **Create index**.+2. Note the displayed job ID and initial state.+3. Tap **Refresh status** periodically.+4. Continue when the state is `success`, `completed`, `done`, or `ok`.++The example creates the image-search index for the same collection and stream:++```dart+final job = await client.indexes.createIndex(+ IndexationSubmitRequest(+ mode: 'vid_file',+ groupName: collectionName,+ streamName: streamName,+ indexType: 'vid_img_emb',+ modality: 'vid_img_emb',+ reProcess: true,+ ),+);+```++Indexing is asynchronous. The create call returning successfully means the job+was accepted, not that search data is ready. Use the visible refresh action or+`client.indexes.indexStatus(job.jobId)` until it reaches a terminal state.++## 10. Search and inspect results++1. Leave the default query, `red`, for the bundled colored sample or enter a+ visual description for your chosen video.+2. Tap **Search** after indexing succeeds.+3. Inspect up to five result cards showing the best available title/item ID,+ source modality, timestamp, and normalized score.++Search and upload use the same **Collection** and **Stream** fields. The example+searches the image index created in the previous step:++```dart+final result = await client.searches.searchVideo(+ SearchRequest(+ queryText: query,+ groupName: collectionName,+ streamName: streamName,+ searchSources: const ['image'],+ ),+);+```++A zero result count is still successful. If the collection has not been+indexed, the server can return HTTP 404 even though the route is working; the+example reports that condition without displaying internal server paths.++## 11. Stop and clean upPress `q` in the terminal to stop `flutter run`.@@ -283,6 +319,9 @@ The main learning points in [`lib/main.dart`](lib/main.dart) are:- `client.auth.me()` resolves the current identity.- `client.searches.searchVideo()` performs natural-language video search.- `client.collections.videoUpload()` creates a cancellable upload task.+- `openFile()` supplies an app-readable video path through `file_selector`.+- `client.indexes.createIndex()` and `indexStatus()` expose background work.+- Raw search rows are rendered as compact result cards.- `rootBundle.load()` copies the bundled sample into a temporary `File`.- `SdkException` provides SDK and API error details.diff --git a/example/android/gradle.properties b/example/android/gradle.propertiesindex e96108c..b65a209 100644--- a/example/android/gradle.properties+++ b/example/android/gradle.properties@@ -2,5 +2,5 @@ org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512mandroid.useAndroidX=true# This newDsl flag was added by the Flutter templateandroid.newDsl=false-# This builtInKotlin flag was added by the Flutter template+# Flutter 3.44 stable auto-applies KGP to Android plugins, so use compatibility mode.android.builtInKotlin=falsediff --git a/example/android/settings.gradle.kts b/example/android/settings.gradle.ktsindex c21f0c5..b076fc6 100644--- a/example/android/settings.gradle.kts+++ b/example/android/settings.gradle.kts@@ -20,6 +20,7 @@ pluginManagement {plugins {id("dev.flutter.flutter-plugin-loader") version "1.0.0"id("com.android.application") version "9.0.1" apply false+ // Flutter 3.44 still auto-applies KGP to Android plugins when built-in Kotlin is disabled.id("org.jetbrains.kotlin.android") version "2.3.20" apply false}diff --git a/example/lib/main.dart b/example/lib/main.dartindex 4c01df4..156f8de 100644--- a/example/lib/main.dart+++ b/example/lib/main.dart@@ -1,10 +1,89 @@import 'dart:async';import 'dart:io';+import 'package:file_selector/file_selector.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:vmodal_sdk_flutter/vmodal_sdk_flutter.dart';+const String exampleCollectionName = 'flutter_example';+const String exampleStreamName = 'astream';+const String exampleIndexType = 'vid_img_emb';++SearchRequest exampleSearchRequest(+ String query,+ String collectionName,+ String streamName,+) => SearchRequest(+ queryText: query.trim(),+ groupName: collectionName.trim(),+ streamName: streamName.trim(),+ searchSources: const <String>['image'],+);++IndexationSubmitRequest exampleIndexRequest(+ String collectionName,+ String streamName,+) => IndexationSubmitRequest(+ mode: 'vid_file',+ groupName: collectionName.trim(),+ streamName: streamName.trim(),+ indexType: exampleIndexType,+ modality: exampleIndexType,+ reProcess: true,+);++bool exampleIndexDone(String status) => const <String>{+ 'success',+ 'succeeded',+ 'done',+ 'completed',+ 'ok',+}.contains(status.trim().toLowerCase());++List<Map<String, Object?>> exampleSearchRows(SearchResponse response) =>+ response.data+ .whereType<Map<Object?, Object?>>()+ .map(+ (Map<Object?, Object?> row) =>+ row.map((Object? key, Object? value) => MapEntry('$key', value)),+ )+ .take(5)+ .toList();++String exampleResultTitle(Map<String, Object?> row) {+ for (final key in <String>[+ 'effective_title',+ 'title',+ 'item_id',+ 'text_agg_tok',+ ]) {+ final value = '${row[key] ?? ''}'.trim();+ if (value.isNotEmpty) return value;+ }+ return 'Untitled result';+}++String exampleResultDetails(Map<String, Object?> row) {+ final values = <String>[];+ final source = '${row['source'] ?? ''}'.trim();+ final timestamp = '${row['ts_unix'] ?? ''}'.trim();+ final score = row['score_ui'];+ if (source.isNotEmpty) values.add(source.toUpperCase());+ if (timestamp.isNotEmpty) values.add('timestamp $timestamp');+ if (score is num) values.add('score ${(score * 100).toStringAsFixed(1)}%');+ return values.isEmpty ? 'Search result' : values.join(' • ');+}++String exampleSearchNotFound(ApiException error, String collectionName) {+ final body = '${error.body}'.toLowerCase();+ if (body.contains('missing lancedb') || body.contains('missing index')) {+ return 'No searchable index exists for $collectionName. '+ 'Upload the video and create its index before searching.';+ }+ return 'The configured gateway does not expose the search route.';+}+void main() => runApp(const VmodalExampleApp());class VmodalExampleApp extends StatefulWidget {@@ -17,16 +96,22 @@ class VmodalExampleApp extends StatefulWidget {class _VmodalExampleAppState extends State<VmodalExampleApp> {static const _sampleAsset = 'asset/video_10frames.mp4';final _key = TextEditingController();- final _query = TextEditingController(text: 'red bicycle');+ final _query = TextEditingController(text: 'red');+ final _collection = TextEditingController(text: exampleCollectionName);+ final _stream = TextEditingController(text: exampleStreamName);final _path = TextEditingController();MutableApiKeyProvider? _keys;VmodalClient? _client;UploadTask<VideoUploadResponse>? _upload;StreamSubscription<UploadProgress>? _progressSub;+ List<Map<String, Object?>> _results = <Map<String, Object?>>[];+ String _jobId = '';+ String _indexStatus = 'not started';String _status ='Enter a runtime API key supplied by your authenticated app.';int _progress = 0;bool _busy = false;+ bool _hasSearched = false;@overridevoid initState() {@@ -75,20 +160,105 @@ class _VmodalExampleAppState extends State<VmodalExampleApp> {});}- Future<void> _search() async {+ Future<void> _pickVideo() async {+ XFile? picked;+ try {+ picked = await openFile(+ acceptedTypeGroups: const <XTypeGroup>[+ XTypeGroup(+ label: 'videos',+ mimeTypes: <String>['video/*'],+ uniformTypeIdentifiers: <String>['public.movie'],+ ),+ ],+ confirmButtonText: 'Choose',+ );+ } on PlatformException {+ _safeState(() => _status = 'Unable to open the native video picker.');+ return;+ }+ final selected = picked;+ if (selected == null) {+ _safeState(() => _status = 'Video selection canceled.');+ return;+ }+ final path = selected.path.trim();+ if (path.isEmpty || !File(path).existsSync()) {+ _safeState(() => _status = 'The selected video has no readable path.');+ return;+ }+ _safeState(() {+ _path.text = path;+ _status = 'Selected ${selected.name}. Upload it next.';+ });+ }++ Future<void> _createIndex() async {final client = _client;if (client == null) return _needClient();+ final collection = _collection.text.trim();+ final stream = _stream.text.trim();+ if (collection.isEmpty || stream.isEmpty) return _needCollection();await _run(() async {- final result = await client.searches.searchVideo(- SearchRequest(queryText: _query.text.trim()),+ final job = await client.indexes.createIndex(+ exampleIndexRequest(collection, stream),);- _safeState(() => _status = 'Search returned ${result.cntActual} items.');+ _safeState(() {+ _jobId = job.jobId;+ _indexStatus = job.status.isEmpty ? 'queued' : job.status;+ _status = 'Index job created. Refresh until its status is success.';+ });+ });+ }++ Future<void> _refreshIndex() async {+ final client = _client;+ if (client == null) return _needClient();+ if (_jobId.isEmpty) {+ _safeState(() => _status = 'Create an index job first.');+ return;+ }+ await _run(() async {+ final job = await client.indexes.indexStatus(_jobId);+ _safeState(() {+ _indexStatus = job.status.isEmpty ? 'unknown' : job.status;+ _status = exampleIndexDone(_indexStatus)+ ? 'Index is ready. Search the collection next.'+ : 'Index status refreshed: $_indexStatus.';+ });+ });+ }++ Future<void> _search() async {+ final client = _client;+ if (client == null) return _needClient();+ final collection = _collection.text.trim();+ final stream = _stream.text.trim();+ if (collection.isEmpty || stream.isEmpty) return _needCollection();+ await _run(() async {+ try {+ final result = await client.searches.searchVideo(+ exampleSearchRequest(_query.text, collection, stream),+ );+ _safeState(() {+ _results = exampleSearchRows(result);+ _hasSearched = true;+ _status =+ 'Search returned ${result.cntActual} items from $collection/$stream.';+ });+ } on ApiException catch (error) {+ if (error.statusCode != 404) rethrow;+ _safeState(() => _status = exampleSearchNotFound(error, collection));+ }});}Future<void> _startUpload() async {final client = _client;if (client == null) return _needClient();+ final collection = _collection.text.trim();+ final stream = _stream.text.trim();+ if (collection.isEmpty || stream.isEmpty) return _needCollection();final file = File(_path.text.trim());if (!file.existsSync()) {_safeState(() => _status = 'Select an app-accessible file first.');@@ -96,8 +266,8 @@ class _VmodalExampleAppState extends State<VmodalExampleApp> {}final task = client.collections.videoUpload(UploadSource.fromFile(file),- collectionName: 'flutter_example',- subCollectionName: 'astream',+ collectionName: collection,+ subCollectionName: stream,);_upload = task;await _progressSub?.cancel();@@ -113,7 +283,11 @@ class _VmodalExampleAppState extends State<VmodalExampleApp> {final result = await task.result;_safeState(() {_progress = 100;- _status = 'Upload complete: ${result.fileName}';+ _jobId = '';+ _indexStatus = 'not started';+ _results = <Map<String, Object?>>[];+ _hasSearched = false;+ _status = 'Upload complete: ${result.fileName}. Create its index next.';});} on OperationCanceled {_safeState(() => _status = 'Upload canceled.');@@ -141,6 +315,21 @@ class _VmodalExampleAppState extends State<VmodalExampleApp> {_safeState(() => _status = 'Configure the client first.');}+ void _needCollection() {+ _safeState(() => _status = 'Collection and stream are required.');+ }++ void _scopeChanged(String _) {+ if (_jobId.isEmpty && _results.isEmpty) return;+ _safeState(() {+ _jobId = '';+ _indexStatus = 'not started';+ _results = <Map<String, Object?>>[];+ _hasSearched = false;+ _status = 'Collection changed. Upload or index this collection next.';+ });+ }+void _safeState(VoidCallback change) {if (mounted) setState(change);}@@ -153,6 +342,8 @@ class _VmodalExampleAppState extends State<VmodalExampleApp> {unawaited(_client?.close());_key.dispose();_query.dispose();+ _collection.dispose();+ _stream.dispose();_path.dispose();super.dispose();}@@ -184,12 +375,14 @@ class _VmodalExampleAppState extends State<VmodalExampleApp> {child: const Text('Resolve auth.me'),),TextField(- controller: _query,- decoration: const InputDecoration(labelText: 'Search query'),+ controller: _collection,+ onChanged: _scopeChanged,+ decoration: const InputDecoration(labelText: 'Collection'),),- FilledButton(- onPressed: _busy ? null : _search,- child: const Text('Search'),+ TextField(+ controller: _stream,+ onChanged: _scopeChanged,+ decoration: const InputDecoration(labelText: 'Stream'),),const Divider(),TextField(@@ -199,6 +392,11 @@ class _VmodalExampleAppState extends State<VmodalExampleApp> {helperText: 'The bundled 10-frame sample is preloaded.',),),+ OutlinedButton.icon(+ onPressed: _busy ? null : _pickVideo,+ icon: const Icon(Icons.video_file),+ label: const Text('Choose video'),+ ),LinearProgressIndicator(value: _progress / 100),Row(children: <Widget>[@@ -215,6 +413,44 @@ class _VmodalExampleAppState extends State<VmodalExampleApp> {),],),+ const Divider(),+ Row(+ children: <Widget>[+ Expanded(+ child: FilledButton(+ onPressed: _busy ? null : _createIndex,+ child: const Text('Create index'),+ ),+ ),+ const SizedBox(width: 8),+ OutlinedButton(+ onPressed: _busy ? null : _refreshIndex,+ child: const Text('Refresh status'),+ ),+ ],+ ),+ Text(+ 'Index: $_indexStatus${_jobId.isEmpty ? '' : ' ($_jobId)'}',+ key: const Key('index-status'),+ ),+ const Divider(),+ TextField(+ controller: _query,+ decoration: const InputDecoration(labelText: 'Search query'),+ ),+ FilledButton(+ onPressed: _busy ? null : _search,+ child: const Text('Search'),+ ),+ if (_hasSearched && _results.isEmpty)+ const Text('No matching results.'),+ for (final row in _results)+ Card(+ child: ListTile(+ title: Text(exampleResultTitle(row)),+ subtitle: Text(exampleResultDetails(row)),+ ),+ ),const SizedBox(height: 16),Text(_status, key: const Key('status')),],diff --git a/example/pubspec.yaml b/example/pubspec.yamlindex 95aa48d..8b63cc4 100644--- a/example/pubspec.yaml+++ b/example/pubspec.yaml@@ -28,6 +28,7 @@ environment:# the latest version available on pub.dev. To see which dependencies have newer# versions available, run `flutter pub outdated`.dependencies:+ file_selector: ^1.1.0flutter:sdk: fluttervmodal_sdk_flutter:diff --git a/example/test/widget_test.dart b/example/test/widget_test.dartindex 0b1b143..05c2b01 100644--- a/example/test/widget_test.dart+++ b/example/test/widget_test.dart@@ -1,14 +1,75 @@+import 'package:flutter/material.dart';import 'package:flutter_test/flutter_test.dart';import 'package:vmodal_example/main.dart';+import 'package:vmodal_sdk_flutter/vmodal_sdk_flutter.dart';void main() {testWidgets('example requires runtime injection', (WidgetTester tester,) async {await tester.pumpWidget(const VmodalExampleApp());- expect(find.textContaining('runtime API key'), findsWidgets);+ expect(find.widgetWithText(TextField, 'Runtime API key'), findsOneWidget);expect(find.text('Configure client'), findsOneWidget);- expect(find.text('Search'), findsOneWidget);+ expect(find.widgetWithText(TextField, 'Collection'), findsOneWidget);+ expect(find.widgetWithText(TextField, 'Stream'), findsOneWidget);+ await tester.drag(find.byType(ListView), const Offset(0, -600));+ await tester.pump();+ expect(find.text('Choose video'), findsOneWidget);expect(find.text('Upload'), findsOneWidget);+ expect(find.text('Create index'), findsOneWidget);+ await tester.drag(find.byType(ListView), const Offset(0, -600));+ await tester.pump();+ expect(find.text('Search'), findsOneWidget);+ });++ test('search and upload share the example collection contract', () {+ final request = exampleSearchRequest(+ ' bicycle ',+ exampleCollectionName,+ exampleStreamName,+ );+ expect(request.queryText, 'bicycle');+ expect(request.groupName, exampleCollectionName);+ expect(request.streamName, exampleStreamName);+ expect(request.searchSources, <String>['image']);++ final index = exampleIndexRequest(exampleCollectionName, exampleStreamName);+ expect(index.groupName, exampleCollectionName);+ expect(index.streamName, exampleStreamName);+ expect(index.indexType, exampleIndexType);+ expect(index.modality, exampleIndexType);+ });++ test('search 404 is explained without exposing the server body', () {+ const path = '/private/server/path/table';+ const error = ApiException(+ 'api request failed',+ statusCode: 404,+ body: <String, Object?>{'detail': 'Missing LanceDB table: $path'},+ );+ final message = exampleSearchNotFound(error, exampleCollectionName);+ expect(message, contains('No searchable index exists'));+ expect(message, isNot(contains(path)));+ });++ test('index states and search result fields are presentation ready', () {+ expect(exampleIndexDone('completed'), isTrue);+ expect(exampleIndexDone('running'), isFalse);+ final response = SearchResponse(<String, Object?>{+ 'cnt_actual': 1,+ 'cnt_total': 1,+ 'data': <Object?>[+ <String, Object?>{+ 'effective_title': 'Red frame',+ 'item_id': 'fallback-id',+ 'source': 'image',+ 'ts_unix': '2000',+ 'score_ui': 0.875,+ },+ ],+ });+ final row = exampleSearchRows(response).single;+ expect(exampleResultTitle(row), 'Red frame');+ expect(exampleResultDetails(row), 'IMAGE • timestamp 2000 • score 87.5%');});}diff --git a/test/shell_scripts_test.dart b/test/shell_scripts_test.dartindex 63b79ca..3ab0772 100644--- a/test/shell_scripts_test.dart+++ b/test/shell_scripts_test.dart@@ -53,6 +53,20 @@ void main() {}});+ test(+ 'development setup invokes install and clean supports public clones',+ () {+ final readme = File('README.md').readAsStringSync();+ expect(readme, contains('bash install.sh install'));+ expect(readme.split('\n'), isNot(contains('bash install.sh')));++ final build = File('build.sh').readAsStringSync();+ expect(build, contains('name: vmodal_sdk_flutter'));+ expect(build, contains('example/pubspec.yaml'));+ expect(build, isNot(contains('*/uinterface/sdk_flutter')));+ },+ );+test('security commands and fixed all ordering are registered', () {final text = File('security_check.sh').readAsStringSync();for (final command in <String>[diff --git a/test/workflow_layout_test.dart b/test/workflow_layout_test.dartindex 87ad3a5..2b1c55e 100644--- a/test/workflow_layout_test.dart+++ b/test/workflow_layout_test.dart@@ -12,6 +12,13 @@ final publicFile = File('release/public_publish.yml').existsSync()? File('release/public_publish.yml'): File('.github/workflows/publish.yml');final public = publicFile.readAsStringSync();+final androidProperties = File(+ 'example/android/gradle.properties',+).readAsStringSync();+final androidSettings = File(+ 'example/android/settings.gradle.kts',+).readAsStringSync();+final examplePubspec = File('example/pubspec.yaml').readAsStringSync();void checkWorkflow(String main, String tagged) {const releaseOnly =@@ -93,6 +100,18 @@ void checkWorkflow(String main, String tagged) {}void main() {+ test('Android example uses Flutter 3.44 AGP 9 compatibility mode', () {+ expect(androidProperties, contains('android.newDsl=false'));+ expect(androidProperties, contains('android.builtInKotlin=false'));+ expect(androidProperties, isNot(contains('android.builtInKotlin=true')));+ expect(+ androidSettings,+ contains('id("org.jetbrains.kotlin.android") version "2.3.20"'),+ );+ expect(examplePubspec, contains('file_selector: ^1.1.0'));+ expect(examplePubspec, isNot(contains('file_picker:')));+ });+test('release workflows enforce tested-source causality', () {if (internal.isEmpty) return;checkWorkflow(internal, public);