getAsset function

String getAsset(
  1. String asset
)

Returns the full path for an asset in /assets directory. Usage e.g. getAsset('videos/welcome.mp4');

Returns a String.

Implementation

String getAsset(String asset) {
  // remove the first slash if it exists
  if (asset.startsWith('/')) {
    asset = asset.substring(1);
  }
  return "${getEnv("ASSET_PATH")}/$asset";
}