fromAssetsBundle method

Future<String?> fromAssetsBundle(
  1. String url
)

Implementation

Future<String?> fromAssetsBundle(String url) async
{
  String? template;
  try
  {
    // not supported on web
    if (isWeb) throw('Local Files not supported in Browser');

    // get template from asset bundle
    template = await rootBundle.loadString(url.replaceFirst("file://", "assets/"), cache: false);
  }
  catch(e)
  {
    template = null;
  }
  return template;
}