Skip to content

About

Flutter fixture project for RTK issue #1098 — sample outputs for flutter analyze, flutter pub get, flutter test

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

rtk_flutter — Example Fixtures for RTK Issue #1098

This Flutter project exists to provide real command outputs for RTK to implement filtering support for Flutter/Dart commands.

Related issue: rtk-ai/rtk#1098

What this repo contains

A Flutter counter app intentionally enriched with:

  • Real dependencies (http, provider, shared_preferences, intl, json_annotation)
  • Code generation with json_serializable and mockito (build_runner targets)
  • Intentional lint issues across multiple files (20 issues across 3 files)
  • Unit tests and widget tests with a mix of passing and intentional failures

Sample outputs

Pre-captured outputs live in samples/. These are the raw fixtures RTK needs to design its filter rules.

File Command Purpose
samples/flutter_pub_get.txt flutter pub get 58 packages resolved, version conflicts shown
samples/flutter_analyze.txt flutter analyze 20 issues: 18 info, 2 warning across 3 files
samples/flutter_test.txt flutter test 11 passed, 3 failed — compact reporter
samples/flutter_test_verbose.txt flutter test --reporter expanded Same, verbose format
samples/build_runner_build.txt dart run build_runner build Fresh build — compiling builders + timing lines
samples/build_runner_cached.txt dart run build_runner build Incremental — all skipped, 0 outputs
samples/build_runner_errors.txt dart run build_runner build SEVERE error with file/line pointer (unsupported type)

To regenerate samples after changing the code:

bash capture_samples.sh

What RTK should filter

flutter pub get

Raw output: 60+ lines listing every resolved/downloaded package.

Desired RTK output:

Resolving dependencies... 58 added, 0 removed.
5 packages have newer versions incompatible with dependency constraints.
Run `flutter pub outdated` for details.

Filter strategy (TOML):

  • Strip lines matching ^\+ / ^- (package download lines) — keep only summary line
  • Keep Changed N dependencies! and outdated notice
  • match_output on No dependencies changed → short-circuit

flutter analyze

Raw output: One line per issue with file path, line, column, rule name.

Desired RTK output:

20 issues found in 3 files (ran in 3.4s)
  2 warnings, 18 info

lib/models/user.dart (8 issues)
  warning  unused_element         _unusedPrivateMethod isn't referenced
  info     always_declare_return_types  toJson missing return type
  ...

lib/services/api_service.dart (6 issues)
  warning  unused_local_variable  'unused' isn't used
  info     avoid_print            Don't invoke 'print' (x3)
  ...

Filter strategy (TOML or Rust):

  • Group issues by file
  • Collapse duplicate lint rules (show count)
  • Promote warnings above infos
  • match_output on No issues found! → ok (no issues)

flutter test

Raw output: Live progress lines +N -M:, failure stack traces, summary.

Desired RTK output:

11 passed, 3 failed (1.2s)

FAILED test/unit/user_test.dart
  x User model > age validation fails for negative age
    Expected: > 0  Actual: -1  (Age should be positive but was -1)
  x AdminUser > strict permission check fails for regular admin
    Expected: true  Actual: false

FAILED test/widget_test.dart
  x Counter widget > counter starts at 5 - intentional failure
    Expected: findsOneWidget  Actual: found 0 widgets with text "5"

Filter strategy (Rust module — structured streaming):

  • Suppress all +N: loading ... lines
  • Suppress +N -M: <test name> progress lines
  • Capture [E] failure entries with their error block
  • Strip stack traces (keep only test file + line)
  • Emit summary: N passed, M failed
  • match_output on All tests passed! → short-circuit

dart run build_runner build

Raw output: Compilation progress lines (Ns compiling builders/aot), per-builder status, warnings and errors with source pointers.

Three scenarios captured:

1. Fresh build (build_runner_build.txt) — 30+ lines of Ns compiling builders/aot, then builder status with timing:

  6s json_serializable on 7 inputs: 1 output, 6 no-op; spent 4s analyzing
  0s mockito:mockBuilder on 6 inputs: 1 output, 2 no-op
  Built with build_runner/aot in 32s; wrote 3 outputs.

2. Cached/incremental (build_runner_cached.txt) — instant, nothing to do:

  Built with build_runner/aot in 0s; wrote 0 outputs.

3. Error (build_runner_errors.txt) — SEVERE with file/line pointer:

E json_serializable on lib/models/product_broken.dart:
  Could not generate `fromJson` code for `imageData`.
  To support the type `Uint8List` you can:
  * Use `JsonConverter` ...
  13 │   final Uint8List imageData;
     │                   ^^^^^^^^^
  Failed to build with build_runner/aot in 0s; wrote 0 outputs.

Filter strategy (TOML):

  • Strip all ^\s+\ds compiling builders/aot lines (startup noise)
  • Strip ^\s+\ds .* skipped lines in clean runs
  • Keep W (warning) and E (error) lines with their indented context block
  • Keep the final Built / Failed summary line
  • Short-circuit on wrote 0 outputs with no errors → ok (nothing to rebuild)

Lint issues by file

lib/models/user.dart

  • prefer_typing_uninitialized_variables — var name
  • always_declare_return_types — toJson() missing return type
  • avoid_print — 2 occurrences
  • prefer_final_locals — var result
  • unused_element (warning) — _unusedPrivateMethod

lib/services/api_service.dart

  • avoid_print — 2 occurrences
  • prefer_final_locals — 3 occurrences
  • unused_local_variable (warning) — var unused

lib/main.dart

  • avoid_print — 2 occurrences
  • prefer_final_locals — 1 occurrence
  • prefer_const_constructors_in_immutables — MyApp constructor
  • prefer_single_quotes — 2 occurrences

About

Flutter fixture project for RTK issue #1098 — sample outputs for flutter analyze, flutter pub get, flutter test

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages