getPublicAsset function

String getPublicAsset(
  1. String asset
)

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

Returns a String.

Implementation

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