extension<T extends Object> method
T
extension<T extends Object>()
Obtains a particular FScalableExtension, such as an app's additional text styles.
Creating and passing a FScalableExtension to FTypography
class AppTypography extends FScalableExtension<AppTypography> {
final TextStyle code;
const AppTypography({required this.code});
@override
AppTypography copyWith({TextStyle? code}) => AppTypography(code: code ?? this.code);
@override
AppTypography lerp(covariant AppTypography? other, double t) =>
other == null ? this : AppTypography(code: TextStyle.lerp(code, other.code, t)!);
@override
AppTypography scale({double sizeScalar = 1.0}) =>
AppTypography(code: code.copyWith(fontSize: (code.fontSize ?? 14) * sizeScalar));
}
final code = context.theme.typography.extension<AppTypography>().code;
Implementation
T extension<T extends Object>() => _extensions[T]! as T;