-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[camera_android_camerax] Setup agent skills camerax #11930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
ee20fa7
feat: Set up agent skills management architecture
reidbaker 26b37ae
feat: Add check-readiness skill
reidbaker d825767
feat: Add local check-readiness skill and configure linter
reidbaker f7f0646
test: ensure tracked skills cannot be published accidentally
reidbaker ea27e43
build: pin dart_skills_lint to support individual_skills
reidbaker 9ac31a2
test: rewrite tracked skills test to use ValidationSession API
reidbaker 87cfaf1
test: fix analyzer warnings
reidbaker acbcc3e
build: update dart_skills_lint to 8f85e82b on main
reidbaker 7eabf5f
test: rewrite tracked skills test to use yaml parsing, address PR com…
reidbaker 9e0d9e5
test: revert yaml parsing, use public ValidationSession from repo
reidbaker 6b68664
test: revert to ValidationSession and use ignore implementation_imports
reidbaker 0942453
test: replace yaml parsing with custom skill rule EnforceTrackedSkill…
reidbaker 9471107
test: extract EnforceTrackedSkillsInternalRule to its own file with docs
reidbaker c4e832f
ci: allow dart_skills_lint in packages
reidbaker acc34a5
test: fix internal rule validation feedback
reidbaker 288e5ec
Fix missing copyright headers in check-readiness agent skill
reidbaker 43be3d1
Support .pubignore in publish-check
reidbaker 8d17949
Add tests for publish_check pubignore parsing
reidbaker 81c1c52
Fix .gitignore for check-readiness skill and symlinked skills
reidbaker 438537c
Revert un-ignoring of symlinked skills
reidbaker f64190b
Add TODO for tracking dart-lang/pub issue 4841
reidbaker 14d7cfc
Group pubignore tracking tests under issue 4841
reidbaker d7f024e
Move TODO out of group name
reidbaker bc37ae6
Fix analyzer warnings
reidbaker 16e3f28
Fix .gitignore un-ignore rule overreach
reidbaker 83638ff
Rename EnforceTrackedSkillsInternalRule to EnforceTrackedSkillsPreven…
reidbaker d93c81e
Move third-party skills to third_party/skill-repos/ and update symlin…
reidbaker 7c080f9
Move third-party README to third_party/skill-repos/ and update refere…
reidbaker 51ecf16
Canonicalize paths for EnforceTrackedSkillsPreventPublishingRule to f…
reidbaker 2271f28
Add path dependency to camera_android_camerax dev_dependencies
reidbaker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
packages/camera/camera_android_camerax/.agents/skills/.gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Ignore everything by default | ||
| * | ||
|
|
||
| # Un-ignore specific checked-in skills | ||
| # (Add specific contributor skills here as they are created) | ||
| !check-readiness/ | ||
|
|
||
| # Keep essential configuration and docs | ||
| !.gitignore | ||
| !README.md | ||
| !ignore.json | ||
| !flutter_skills_ignore.json |
8 changes: 8 additions & 0 deletions
8
packages/camera/camera_android_camerax/.agents/skills/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Agent Skills | ||
|
|
||
| This directory contains skills intended for repository maintainers and contributors. Local, checked-in skills are evaluated by `dart_skills_lint` and should be configured to prevent publishing to pub.dev. | ||
|
|
||
| **Note on Remotely Managed Skills:** | ||
| Skills that are remotely defined and managed using `npx skills` should **not** be installed directly into this directory. Instead, they must be installed into the repository root's `third_party/` directory to comply with third-party code policies. Once installed there, they should be symlinked into this directory. | ||
|
|
||
| Please see the `third_party/README.md` file at the root of the repository for specific rules and instructions on adding new remote skills. |
19 changes: 19 additions & 0 deletions
19
packages/camera/camera_android_camerax/.agents/skills/check-readiness/SKILL.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| name: check-readiness | ||
| description: Run this skill to check if the repository is ready for new work. Use this skill whenever the user asks to "check readiness", "see if we are ready to start work", or when starting a new task in the camera_android_camerax package. | ||
| metadata: | ||
| internal: true | ||
| --- | ||
| # Check Readiness | ||
|
|
||
| This skill verifies that the local environment is properly configured and clean before starting new work in the `camera_android_camerax` package. | ||
|
|
||
| ## Instructions | ||
| Run the bundled verification script to perform the automated environment checks: | ||
| ```bash | ||
| bash .agents/skills/check-readiness/scripts/check.sh | ||
|
reidbaker marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
| ### Handling the Results | ||
| 1. **If the script succeeds:** Inform the user that the environment is clean, dependencies are resolved, and it is ready for new work. | ||
| 2. **If the script fails:** Explain exactly which check failed (e.g., git is not clean, a symlink is broken, Flutter is missing from PATH) and offer to help resolve it. | ||
1 change: 1 addition & 0 deletions
1
packages/camera/camera_android_camerax/.agents/skills/dart-add-unit-test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../../third_party/dart-lang-skills/.agents/skills/dart-add-unit-test |
1 change: 1 addition & 0 deletions
1
packages/camera/camera_android_camerax/.agents/skills/dart-collect-coverage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../../third_party/dart-lang-skills/.agents/skills/dart-collect-coverage |
1 change: 1 addition & 0 deletions
1
packages/camera/camera_android_camerax/.agents/skills/dart-generate-test-mocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../../third_party/dart-lang-skills/.agents/skills/dart-generate-test-mocks |
1 change: 1 addition & 0 deletions
1
packages/camera/camera_android_camerax/.agents/skills/dart-run-static-analysis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../../third_party/dart-lang-skills/.agents/skills/dart-run-static-analysis |
1 change: 1 addition & 0 deletions
1
packages/camera/camera_android_camerax/.agents/skills/flutter-add-integration-test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../../third_party/flutter-skills/.agents/skills/flutter-add-integration-test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../../third_party/mattpocock-skills/.agents/skills/grill-me |
1 change: 1 addition & 0 deletions
1
packages/camera/camera_android_camerax/.agents/skills/receiving-code-review
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../../third_party/obra-superpowers/.agents/skills/receiving-code-review |
10 changes: 10 additions & 0 deletions
10
packages/camera/camera_android_camerax/dart_skills_lint.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| dart_skills_lint: | ||
| rules: | ||
| check-relative-paths: error | ||
| check-trailing-whitespace: error | ||
| directories: | ||
| - path: "skills" | ||
| individual_skills: | ||
| - path: ".agents/skills/check-readiness" | ||
| rules: | ||
| prevent-skills-sh-publishing: error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Published Skills | ||
|
|
||
| This directory contains AI agent skills that are intended to be published to pub.dev. |
65 changes: 65 additions & 0 deletions
65
packages/camera/camera_android_camerax/test/tracked_skills_publishing_test.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| // Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file | ||
| // for details. All rights reserved. Use of this source code is governed by a | ||
| // BSD-style license that can be found in the LICENSE file. | ||
|
|
||
| import 'dart:io'; | ||
|
|
||
| import 'package:dart_skills_lint/src/config_parser.dart'; | ||
| import 'package:dart_skills_lint/src/models/analysis_severity.dart'; | ||
| import 'package:dart_skills_lint/src/validation_session.dart'; | ||
|
reidbaker marked this conversation as resolved.
Outdated
|
||
| import 'package:flutter_test/flutter_test.dart'; | ||
|
|
||
| void main() { | ||
| test('all tracked skills have prevent-skills-sh-publishing rule explicitly configured', () async { | ||
| // Explanation: | ||
| // Any skill in .agents/skills/ that is checked into version control is considered an internal skill. | ||
| // It must explicitly have the `prevent-skills-sh-publishing` rule configured in dart_skills_lint.yaml | ||
| // to prevent accidental publishing. | ||
|
|
||
| // 1. Get tracked files using git ls-files | ||
| final ProcessResult processResult = await Process.run('git', ['ls-files', '.agents/skills']); | ||
| expect(processResult.exitCode, 0, reason: 'git ls-files should succeed'); | ||
|
|
||
| final output = processResult.stdout as String; | ||
| final Iterable<String> lines = output.split('\n').where((line) => line.trim().isNotEmpty); | ||
|
|
||
| final trackedSkillDirs = <String>{}; | ||
| for (final line in lines) { | ||
| final List<String> parts = line.split('/'); | ||
| // We look for files inside .agents/skills/<skill-name>/ | ||
| // parts[0] is .agents, parts[1] is skills | ||
| if (parts.length >= 4 && parts[0] == '.agents' && parts[1] == 'skills') { | ||
| trackedSkillDirs.add(parts[2]); | ||
| } | ||
| } | ||
|
reidbaker marked this conversation as resolved.
Outdated
|
||
|
|
||
| expect(trackedSkillDirs, isNotEmpty, reason: 'Should find at least one tracked skill'); | ||
|
|
||
| // 2. Parse configuration | ||
| final Configuration config = await ConfigParser.loadConfig(); | ||
| final session = ValidationSession( | ||
| config: config, | ||
| resolvedRules: <String, AnalysisSeverity>{}, | ||
| ignoreFileOverride: null, | ||
| customRules: const [], | ||
| printWarnings: false, | ||
| fastFail: false, | ||
| quiet: true, | ||
| generateBaseline: false, | ||
| fix: false, | ||
| fixApply: false, | ||
| ); | ||
|
|
||
| for (final skillDir in trackedSkillDirs) { | ||
| final expectedPath = '.agents/skills/$skillDir'; | ||
| final Map<String, AnalysisSeverity> resolvedRules = session.resolveRulesForPath(expectedPath); | ||
|
|
||
| expect( | ||
| resolvedRules.containsKey('prevent-skills-sh-publishing'), | ||
| isTrue, | ||
| reason: | ||
| 'The tracked skill "$skillDir" must have "prevent-skills-sh-publishing" explicitly configured in dart_skills_lint.yaml.', | ||
| ); | ||
| } | ||
| }); | ||
| } | ||
27 changes: 27 additions & 0 deletions
27
packages/camera/camera_android_camerax/test/validate_skills_test.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import 'dart:async'; | ||
|
|
||
| import 'package:dart_skills_lint/dart_skills_lint.dart'; | ||
| import 'package:flutter/foundation.dart'; | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:logging/logging.dart'; | ||
|
|
||
| void main() { | ||
| test('Validate Skills', () async { | ||
| final Level oldLevel = Logger.root.level; | ||
| Logger.root.level = Level.ALL; | ||
| final StreamSubscription<LogRecord> subscription = Logger.root.onRecord.listen((record) { | ||
| debugPrint(record.message); | ||
| }); | ||
|
|
||
| try { | ||
| final Configuration config = await ConfigParser.loadConfig(); | ||
| final bool isValid = await validateSkills( | ||
| config: config, | ||
| ); | ||
| expect(isValid, isTrue, reason: 'Skills validation failed. See above for details.'); | ||
| } finally { | ||
| Logger.root.level = oldLevel; | ||
| await subscription.cancel(); | ||
| } | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Third-Party Agent Skills | ||
|
|
||
| To comply with third-party code policies, all remotely managed agent skills (installed via `npx skills`) must be isolated in this `third_party/` directory before being symlinked to specific project `.agents/skills` directories. | ||
|
|
||
| ## Rules for Adding New Remote Skills | ||
|
|
||
| When adding a new remote skill, you must follow this exact structure and process: | ||
|
|
||
| 1. **Folder per Repository:** Create a new folder under `third_party/` named uniquely after the GitHub repository the skill originates from (e.g., `third_party/dart-lang-skills`). | ||
|
|
||
| 2. **Installation:** Run the `npx skills` command from *within* that new repository folder. This ensures the `skills-lock.json` file is correctly generated inside the subfolder. All `skills-lock.json` files must be generated by the CLI, not manually crafted. | ||
| ```bash | ||
| cd third_party/<repo-name> | ||
| npx skills add <author/repo> --skill <skill-name> -y | ||
| ``` | ||
|
|
||
| 3. **License Requirement:** You **must** download and retain the original `LICENSE` file from the remote repository and place it directly inside the `third_party/<repo-name>` subfolder. | ||
|
|
||
| 4. **Symlinking:** Once installed, symlink the newly downloaded skill into the appropriate project's `.agents/skills` directory using a relative symlink. | ||
|
reidbaker marked this conversation as resolved.
Outdated
|
||
| ```bash | ||
| cd packages/<plugin-name>/.agents/skills | ||
| ln -s ../../../../../third_party/<repo-name>/.agents/skills/<skill-name> <skill-name> | ||
| ``` | ||
|
reidbaker marked this conversation as resolved.
Outdated
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 404: Not Found | ||
|
reidbaker marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "version": 1, | ||
| "skills": { | ||
| "skill-creator": { | ||
| "source": "anthropics/skills", | ||
| "sourceType": "github", | ||
| "skillPath": "skills/skill-creator/SKILL.md", | ||
| "computedHash": "5ea13a6d9f0d4bb694405d79acd00cadec0d21bb138c4dd10fcf3c500cb835c2" | ||
| } | ||
| } | ||
| } |
122 changes: 122 additions & 0 deletions
122
third_party/dart-lang-skills/.agents/skills/dart-add-unit-test/SKILL.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| --- | ||
| name: dart-add-unit-test | ||
| description: Write and organize unit tests for functions, methods, and classes using `package:test`. Use when creating new logic or fixing bugs to ensure code remains correct and regression-free. | ||
| metadata: | ||
| model: models/gemini-3.1-pro-preview | ||
| last_modified: Fri, 24 Apr 2026 15:07:58 GMT | ||
| --- | ||
| # Testing Dart and Flutter Applications | ||
|
|
||
| ## Contents | ||
| - [Structuring Test Files](#structuring-test-files) | ||
| - [Writing Tests](#writing-tests) | ||
| - [Executing Tests](#executing-tests) | ||
| - [Test Implementation Workflow](#test-implementation-workflow) | ||
| - [Examples](#examples) | ||
|
|
||
| ## Structuring Test Files | ||
| Organize test files to mirror the `lib` directory structure to maintain predictability. | ||
|
|
||
| * Place all test code within the `test` directory at the root of the package. | ||
| * Append `_test.dart` to the end of all test file names (e.g., `lib/src/utils.dart` should be tested in `test/src/utils_test.dart`). | ||
| * If writing integration tests, place them in an `integration_test` directory at the root of the package. | ||
|
|
||
| ## Writing Tests | ||
| Utilize `package:test` as the standard testing library for Dart applications. | ||
|
|
||
| * Import `package:test/test.dart` (or `package:flutter_test/flutter_test.dart` for Flutter). | ||
| * Group related tests using the `group()` function to provide shared context. | ||
| * Define individual test cases using the `test()` function. | ||
| * Validate outcomes using the `expect()` function alongside matchers (e.g., `equals()`, `isTrue`, `throwsA()`). | ||
| * Write asynchronous tests using standard `async`/`await` syntax. The test runner automatically waits for the `Future` to complete. | ||
| * Manage test setup and teardown using `setUp()` and `tearDown()` callbacks. | ||
| * If testing code that relies on dependency injection, use `package:mockito` alongside `package:test` to generate mock objects, configure fixed scenarios, and verify interactions. | ||
|
|
||
| ## Executing Tests | ||
| Select the appropriate test runner based on the project type and test location. | ||
|
|
||
| * If working on a pure Dart project, execute tests using the `dart test` command. | ||
| * If working on a Flutter project, execute tests using the `flutter test` command. | ||
| * If running integration tests, explicitly specify the directory path, as the default runner ignores it: `dart test integration_test` or `flutter test integration_test`. | ||
|
|
||
| ## Test Implementation Workflow | ||
|
|
||
| Follow this sequential workflow when implementing new test suites. Copy the checklist to track your progress. | ||
|
|
||
| ### Task Progress | ||
| - [ ] 1. Create the test file in the `test/` directory, ensuring the `_test.dart` suffix. | ||
| - [ ] 2. Import `package:test/test.dart` and the target library. | ||
| - [ ] 3. Define a `main()` function. | ||
| - [ ] 4. Initialize shared resources or mocks using `setUp()`. | ||
| - [ ] 5. Write `test()` cases grouped by functionality using `group()`. | ||
| - [ ] 6. Execute the test suite using the appropriate CLI command. | ||
| - [ ] 7. **Feedback Loop**: Run test -> Review stack trace for failures -> Fix implementation or assertions -> Re-run until passing. | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Standard Unit Test Suite | ||
| Demonstrates grouping, setup, synchronous, and asynchronous testing. | ||
|
|
||
| ```dart | ||
| import 'package:test/test.dart'; | ||
| import 'package:my_package/calculator.dart'; | ||
| void main() { | ||
| group('Calculator', () { | ||
| late Calculator calc; | ||
| setUp(() { | ||
| calc = Calculator(); | ||
| }); | ||
| test('adds two numbers correctly', () { | ||
| expect(calc.add(2, 3), equals(5)); | ||
| }); | ||
| test('handles asynchronous operations', () async { | ||
| final result = await calc.fetchRemoteValue(); | ||
| expect(result, isNotNull); | ||
| expect(result, greaterThan(0)); | ||
| }); | ||
| }); | ||
| } | ||
| ``` | ||
|
|
||
| ### Mocking with Mockito | ||
| Demonstrates configuring a mock object for dependency injection testing. | ||
|
|
||
| ```dart | ||
| import 'package:test/test.dart'; | ||
| import 'package:mockito/mockito.dart'; | ||
| import 'package:mockito/annotations.dart'; | ||
| import 'package:my_package/api_client.dart'; | ||
| import 'package:my_package/data_service.dart'; | ||
| // Generate the mock using build_runner: dart run build_runner build | ||
| @GenerateNiceMocks([MockSpec<ApiClient>()]) | ||
| import 'data_service_test.mocks.dart'; | ||
| void main() { | ||
| group('DataService', () { | ||
| late MockApiClient mockApiClient; | ||
| late DataService dataService; | ||
| setUp(() { | ||
| mockApiClient = MockApiClient(); | ||
| dataService = DataService(apiClient: mockApiClient); | ||
| }); | ||
| test('returns parsed data on successful API call', () async { | ||
| // Configure the mock | ||
| when(mockApiClient.get('/data')).thenAnswer((_) async => '{"id": 1}'); | ||
| // Execute the system under test | ||
| final result = await dataService.fetchData(); | ||
| // Verify outcomes and interactions | ||
| expect(result.id, equals(1)); | ||
| verify(mockApiClient.get('/data')).called(1); | ||
| }); | ||
| }); | ||
| } | ||
| ``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.