findExpose method
Finds the Expose declaration for this class.
The expose field takes precedence over a class-level @Expose
annotation, which is only read when reflection is enabled.
If concreteOnly is false, then if there is no actual
Expose, one will be automatically created.
Implementation
Expose? findExpose(Reflector reflector, {bool concreteOnly = false}) {
var existing =
expose ??
(canReflect(reflector)
? reflector
.reflectClass(runtimeType)!
.annotations
.map((m) => m.reflectee)
.firstWhere((r) => r is Expose, orElse: () => null)
as Expose?
: null);
return existing ??
(concreteOnly
? null
: Expose(
ReCase(runtimeType.toString()).snakeCase
.replaceAll('_controller', '')
.replaceAll('_ctrl', '')
.replaceAll(_rgxMultipleUnderscores, '_'),
));
}