app_events library

Reporting what the app did — network calls, queries, analytics, logs.

One call, and whichever surfaces are listening pick it up: a scenario run shows it on the step's Events pane, a mounted devbar shows it on its own tabs. Outside both, every call is a no-op.

Separate from flutter_test.dart on purpose: a project's fakes and its real clients report through here, and neither may import flutter_test.

import 'package:flutterware/app_events.dart';

class FakeApi implements Api {
  Future<User> login(String email) async {
    recordAppEvent(
        AppEvent.request(method: 'POST', url: '/login', status: 200));
    return User(email);
  }
}

Classes

AppChannel
The channel an event travelled on — what the panel filters and groups by.
AppEvent
One thing that happened on the way from one step to the next.

Functions

addAppEventListener(void listener(AppEvent), {Object? ignoreSource}) → void Function()
Subscribes listener to every event reported from now on, and returns the call that unsubscribes it.
recordAppEvent(AppEvent event, {Object? source}) → void
Reports event to every surface that is listening.