fromDisk method

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

Implementation

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

    // get template from file
    Uri? uri = URI.parse(url);
    String? filepath = uri?.asFilePath();
    template = await Platform.readFile(filepath);
  }
  catch(e)
  {
    template = null;
  }
  return template;
}