flutter_beacon_widget_extension 0.1.1
flutter_beacon_widget_extension: ^0.1.1 copied to clipboard
Automatic E2E UI map for Flutter. Auto-detects interactive widgets with ValueKey and generates *.beacon.dart files so AI tools (Maestro + Claude) can write stable E2E flows.
flutter_beacon_widget_extension example #
1. Add to pubspec.yaml #
dependencies:
flutter_beacon_widget_extension: ^0.1.0
dev_dependencies:
build_runner: ^2.0.0
2. Configure build.yaml #
targets:
$default:
builders:
flutter_beacon_widget_extension|flutter_beacon_widget_extension:
enabled: true
generate_for:
- lib/features/**/presentation/**/*.dart
3. Add keys to native widgets (no annotation needed) #
TextField(
key: const ValueKey('login_email_field'),
controller: _emailController,
)
ElevatedButton(
key: const ValueKey('login_submit_button'),
onPressed: _submit,
child: const Text('Entrar'),
)
4. Wrap custom components with BeaconWidget #
BeaconWidget(
id: 'radar_card',
description: 'Radar alert card — tap for details, swipe to dismiss',
type: BeaconType.card,
actions: [BeaconAction.tap, BeaconAction.swipe],
child: RadarCard(radar: radar),
)
5. Annotate screen-level widgets #
@Beacon(
description: 'Login screen — email + password form',
type: BeaconType.screen,
)
class LoginPage extends StatefulWidget { ... }
6. Generate #
flutter pub run build_runner build
7. Generated output (login_page.beacon.dart) #
// GENERATED BY flutter_beacon_widget_extension — DO NOT EDIT.
const List<BeaconInfo> loginPageBeacons = [
BeaconInfo(
key: 'login_email_field',
type: BeaconType.textField,
actions: [BeaconAction.tap, BeaconAction.input, BeaconAction.assertVisible],
...
),
BeaconInfo(
key: 'login_submit_button',
type: BeaconType.button,
actions: [BeaconAction.tap, BeaconAction.assertVisible],
...
),
];
8. Use in Maestro (read the .beacon.dart first) #
- tapOn:
id: "login_email_field"
- inputText: "user@example.com"
- tapOn:
id: "login_submit_button"