Hook-calling facade for custom / ad-hoc styles.
Allows any plugin to register named styles under the styles:custom hook
without needing a dedicated facade method per style. Useful for one-off or
plugin-specific styles that don't belong in the core style contracts.
Registering a custom style
// In any FeaturePlugin.onRegister():
hookRegistry.register('styles:custom', (data) {
final map = data as Map<String, dynamic>;
final name = map['name'] as String;
final context = map['context'] as BuildContext;
switch (name) {
case 'promo_badge':
return TextStyle(fontSize: 10, color: Theme.of(context).colorScheme.error);
default:
return map; // pass through unknown names to lower-priority handlers
}
});
Consuming a custom style
import 'package:moose_core/ui.dart';
final style = AppCustomStyles.get<TextStyle>(context, 'promo_badge');
final card = AppCustomStyles.get<BoxDecoration>(context, 'card_elevated');
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get<
T> (BuildContext context, String name) → T -
Returns the custom style registered under
namevia thestyles:customhook, cast toT.