# AssetResource class abstract

An abstract representation of a resource that wraps either:

- Raw textual content (e.g., JSON, YAML, Dart code, properties).
- An Asset object.

This abstraction allows working uniformly with both inline content and file-based assets. The actual implementation is provided by the private class `_AssetResource`.

### Example: Creating from raw content

    final resource = AssetResource('{ "name": "example" }');
    print(resource.source); // prints the JSON string

### Example: Creating from an Asset

    final asset = FileAsset('/path/to/config.yaml');
    final resource = AssetResource(asset);
    print(resource.source); // prints the FileAsset instance

### Extension Strategies

Developers can plug in custom extension strategies to determine the file extension dynamically:

    AssetResource.registerExtensionStrategy((source) {
      if (source is String && source.endsWith('.conf')) {
        return 'conf';
      }
      return null;
    });

### Content Detectors

Similarly, content detectors decide whether a `String` is inline content or a path:

    AssetResource.registerContentDetector((source) {
      if (source is String && source.contains('{')) return true;
      return false;
    });

Inheritance
  - Object
  - ResourceDeclaration
  - Asset
  - AssetResource
Available extensions
  - AssetExtension

## Constructors

AssetResource.new(Object source)
  Factory constructor for creating an AssetResource.
  factory

## Properties

hashCode → int
  The hash code for this object.
  no setter inherited
runtimeType → Type
  A representation of the runtime type of the object.
  no setter inherited
source → Object
  The underlying source of this resource.
  no setter

## Methods

getContentAsString() → String

  Available on Asset, provided by the AssetExtension extension

  Extension methods for Asset objects.
getContentBytes() → Uint8List
  Returns the binary content of the asset (same as `_contentBytes`).
  inherited
getFileName() → String
  Returns the name of the file (same as `_fileName`).
  inherited
getFilePath() → String
  Returns the full path to the file (same as `_filePath`).
  inherited
getPackageName() → String?
  Returns the name of the originating package (same as `_packageName`).
  inherited
getUniqueName() → String
  Returns a unique name for the asset, combining the package name and file name.
  inherited
noSuchMethod(Invocation invocation) → dynamic
  Invoked when a nonexistent method or property is accessed.
  inherited
toJson() → Map<String, Object>
  Serializes this resource to a JSON-encodable map.
  inherited
toString() → String
  Standard string representation of this resource.
  inherited

## Operators

operator ==(Object other) → bool
  The equality operator.
  inherited

## Static Methods

determineExtension(Object source) → String?
  Determines the file extension for a given `source`.
getIsContent(Object source) → bool
  Determines whether a given `source` should be treated as inline content.
registerContentDetector(AssetResourceContentDetector detector) → void
  Registers a new content detector.
registerExtensionStrategy(AssetResourceExtensionStrategy strategy) → void
  Registers a new extension strategy.