fromAsset static method

bool fromAsset(
  1. String? path
)

Checks whether path contains the predefined _imagePath. Returns true if the given path points to an image inside your app's assets folder.

Implementation

static bool fromAsset(String? path) {
  if (path == null || path.isEmpty) {
    return false;
  }

  // Normalize slashes
  final normalized = path.replaceAll('\\', '/').toLowerCase();

  // Match paths like:
  // - assets/images/icon.png
  // - assets/icons/logo.webp
  // - assets/some_folder/img.jpg
  return normalized.startsWith('assets/');
}