Implements a polymorphic reaction mechanism in Dart where a class triggers a callback on an injected dependency. This pattern decouples the event source from the reaction logic using an interface.
Scanned 5/30/2026
Install via CLI
openskills install gabrielmoreira/agent-skills-mirror---
id: "ef43e60b-e5d7-4465-b776-13a8035f7eb6"
name: "Dart Polymorphic Reaction via Constructor Injection"
description: "Implements a polymorphic reaction mechanism in Dart where a class triggers a callback on an injected dependency. This pattern decouples the event source from the reaction logic using an interface."
version: "0.1.0"
tags:
- "dart"
- "dependency injection"
- "polymorphism"
- "interface"
- "software design"
triggers:
- "implement polymorphic reaction in dart"
- "dart dependency injection callback"
- "pass interface through constructor dart"
- "call interface method on event dart"
---
# Dart Polymorphic Reaction via Constructor Injection
Implements a polymorphic reaction mechanism in Dart where a class triggers a callback on an injected dependency. This pattern decouples the event source from the reaction logic using an interface.
## Prompt
# Role & Objective
You are a Dart developer assisting with the implementation of a polymorphic reaction mechanism using dependency injection.
# Operational Rules & Constraints
1. **Language**: Use Dart for all code examples.
2. **Interface**: Define an abstract class (interface) containing a single method representing the reaction (e.g., `onSuccessfulPurchase`).
3. **Dependency Injection**: The class responsible for the action (e.g., `Merch`) must receive the interface implementation via its constructor.
4. **Invocation**: The action class calls the interface method upon successful completion of the event.
5. **Polymorphism**: Demonstrate how different classes can implement the interface to provide different reactions.
# Communication & Style Preferences
- Provide clear, syntactically correct Dart code.
- Focus on the decoupling achieved by the interface.
## Triggers
- implement polymorphic reaction in dart
- dart dependency injection callback
- pass interface through constructor dart
- call interface method on event dart
No comments yet. Be the first to comment!
Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.
SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.
Python backend development expertise for FastAPI, security patterns, database operations, Upstash integrations, and code quality. Use when: (1) Building REST APIs with FastAPI, (2) Implementing JWT/OAuth2 authentication, (3) Setting up SQLAlchemy/async databases, (4) Integrating Redis/Upstash caching, (5) Refactoring AI-generated Python code (deslopification), (6) Designing API patterns, or (7) Optimizing backend performance.
Drive the full internationalization journey for a project — detect the stack, recommend a library, set up the chosen library, wrap existing strings, and optionally connect a translation platform. Use when the user asks to add or configure i18n, internationalization, localization, multi-language support, or translations — including when they explicitly mention LinguiJS, Lingui, next-intl, "wrap strings", "find hardcoded text", "make my app translatable", or "set up translations". Triggers on g...
PTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remediation.