import method Null safety

Future<Tuple2<AsyncImporter, Stylesheet>?> import(
  1. Uri url,
  2. {AsyncImporter? baseImporter,
  3. Uri? baseUrl,
  4. bool forImport = false}

Tries to import url using one of this cache's importers.

If baseImporter is non-null, this first tries to use baseImporter to import url (resolved relative to baseUrl if it's passed).

If any importers can import url, returns that importer as well as the parsed stylesheet. Otherwise, returns null.

Caches the result of the import and uses cached results if possible.


Future<Tuple2<AsyncImporter, Stylesheet>?> import(Uri url,
    {AsyncImporter? baseImporter,
    Uri? baseUrl,
    bool forImport = false}) async {
  var tuple = await canonicalize(url,
      baseImporter: baseImporter, baseUrl: baseUrl, forImport: forImport);
  if (tuple == null) return null;
  var stylesheet = await importCanonical(tuple.item1, tuple.item2,
      originalUrl: tuple.item3);
  if (stylesheet == null) return null;
  return Tuple2(tuple.item1, stylesheet);