AssetResourceExtensionStrategy typedef
A function signature for determining the extension of an AssetResource.
This strategy receives a source
object, which can either be a String
(representing raw content or a path) or an Asset. The function should
return:
- A file extension (without a leading dot) if it can determine one.
null
if the extension cannot be determined.
You can register custom strategies using:
AssetResource.registerExtensionStrategy((source) {
if (source is String && source.endsWith('.yaml')) {
return 'yaml';
}
return null;
});
Implementation
typedef AssetResourceExtensionStrategy = String? Function(Object source);