/flutter-clean-riverpod-skills:flutter-ui-side-effectsfrom flutter-clean-riverpod-skills
Declares Flutter UI side effects (navigation, snackbars, dialogs, analytics) via ref.listen listener widgets grouped per feature, reacting to state changes instead of inline callbacks.
Ships in flutter-clean-riverpod-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Side effects (navigation, snackbars, dialogs, analytics) are never
performed inline in button callbacks or scattered through widgets. They are
declared with ref.listen, grouped in one listener widget per feature
placed near the page root.
onPressed handlers.submit() runs before the request has succeeded. A listener fires when the
state actually becomes success or error.child
untouched, so it never rebuilds the page beneath it.flutter-testing).Template: assets/feature_listeners.dart.
class ItemsListeners extends ConsumerWidget with FailureMessageMapper {
const ItemsListeners({required this.child, super.key});
final Widget child;
@override
Widget build(BuildContext context, WidgetRef ref) {
ref.listen(itemSubmissionProvider, (previous, next) {
switch (next) {
case AsyncData(value: final result?): // success
...
case AsyncError(error: final AppFailure failure): // failure
AppSnackBar.show(context, message: failureMessage(context.l10n, failure));
default:
break;
}
});
return child;
}
}
Pages wrap their Scaffold:
return ItemsListeners(child: Scaffold(...));
<Feature>Listeners, under
features/<feature>/presentation/widgets/.ref.listen, not ref.watch, inside the listener widget, and return
child unchanged.autoDispose provider
(AsyncValue<T?>, idle = AsyncData(null)), never in the app-wide session
provider and never in setState. Use SubmissionNotifier from
flutter-result-errors.submission.isLoading drives a button's loading flag); the listener owns
the imperative reactions.AppSnackBar),
never raw SnackBars sprinkled around.FailureMessageMapper, not from failure.message.
Template: assets/failure_message_mapper.dart.if ladders about business state is a
missing domain method.AsyncValue in a listenerPattern-match, most specific first:
switch (next) {
case AsyncData(value: final result?): // success
...
case AsyncError(error: final AppFailure f) when isInline(f): // shown by the form
break;
case AsyncError(error: final AppFailure f): // everything else
...
default: // idle / loading
break;
}
Skip failures another widget already presents (field validation) and
CancelledFailure (the user backed out; staying silent is the right UX).
A listener can fire for a rebuild that changed nothing relevant. Compare
previous and next:
ref.listen(itemsProvider, (previous, next) {
final topic = next.value?.topic;
if (topic == null || topic == previous?.value?.topic) return; // no change
ref.read(analyticsServiceProvider).track(ItemsFilteredEvent(topic: topic));
});
context.router. A global listener in
MaterialApp.builder must reach the router through a provider
(ref.read(appRouterProvider)), not through context.await, check context.mounted before using context.ref.listen does not fire for the initial value (unless
fireImmediately: true). Use that deliberately, rarely.ref.watch inside the listener to read a value you need in the
callback; use ref.read in the callback.Navigator, context.router, ScaffoldMessenger or analytics call in an onPressed<Feature>Listeners per feature, wrapping the page, returning childref.listen follows the state its effect depends onautoDispose submission provider, not session state or setStateCancelledFailure and inline-handled failures stay silentprevious and nextWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
flutter, side-effects, listener-widgets, state-management, river
npx claudepluginhub ethiel97/flutter-clean-riverpod-skills --plugin flutter-clean-riverpod-skills6 skills in this plugin
/flutter-feature-scaffoldUse when adding a new feature or module to a Flutter app that follows feature-first Clean Architecture (data / domain / presentation) with Riverpod 3 and no code generation for providers, when deciding which layer or folder a file belongs in, or when reviewing dependency direction between layers. Provides the folder layout, per-layer rules, barrel conventions, build order and a scaffold script./flutter-result-errorsUse when writing or reviewing Flutter data-layer, repository or provider code that can fail, when adding Result/AsyncResult types or failure types, when mapping exceptions to user-facing errors, or when an exception is crossing a layer boundary. Sets up a sealed AppFailure taxonomy, Result typedefs over result_dart, one catch boundary (RemoteDataSourceGuard) and the way presentation folds failures./flutter-riverpod3Use when writing or reviewing Riverpod 3 code in a Flutter app WITHOUT code generation - choosing a provider type, wiring dependency injection, writing Notifier or AsyncNotifier classes, using ref.watch / read / listen / select, handling disposal, mounted checks and automatic retry, or when someone proposes riverpod_generator, @riverpod, StateNotifier, Bloc, GetIt or the provider package./flutter-sdk-contractsUse when adding, replacing or touching any third-party SDK or platform plugin in a Flutter app (Firebase, Sentry, PostHog, Dio, secure storage, shared_preferences, notifications, share, clipboard, permissions, purchases), or when feature code imports an SDK directly. Defines application-owned contracts (ports), adapters, no-op/composite/recording implementations and their Riverpod wiring./flutter-testingUse when writing or reviewing tests for a Flutter app that uses Riverpod, Result-based repositories and SDKs behind contracts - unit tests for data sources, repositories and notifiers, widget tests with provider overrides, listener tests with recording fakes, golden tests, or deciding between a mock and a fake.Other plugins' skills for the same job