FontAsset constructor
Implementation
FontAsset({
required this.family,
List<String> assets = const [],
this.flavor,
}) {
fonts = assets.map((asset) {
final attrs = _getAttributes(asset);
return (
asset: asset,
style: attrs?.firstWhereOrNull((attr) {
return _fontStyles.contains(attr);
}),
weight: () {
final attr = attrs?.firstWhereOrNull((element) {
return RegExp(r'^w\d{3}$').hasMatch(element);
});
if (attr == null) {
return null;
}
return int.parse(attr.replaceAll('w', ''));
}(),
);
}).toList();
}