AssetResourceContentDetector typedef

AssetResourceContentDetector = bool Function(Object source)

A function signature for detecting whether a given source should be treated as content rather than a file path.

The function receives a source which may be:

  • A String containing raw content or a path-like string.
  • An Asset instance.

The function should return:

  • true if the source represents inline content.
  • false if the source represents a file path or non-content.

You can register custom detectors using:

AssetResource.registerContentDetector((source) {
  if (source is String && source.trim().startsWith('<html>')) {
    return true;
  }
  return false;
});

Implementation

typedef AssetResourceContentDetector = bool Function(Object source);