compileToResultAsync function

Future<CompileResult> compileToResultAsync(
  1. String path, {
  2. bool color = false,
  3. Logger? logger,
  4. Iterable<AsyncImporter>? importers,
  5. PackageConfig? packageConfig,
  6. Iterable<String>? loadPaths,
  7. Iterable<AsyncCallable>? functions,
  8. OutputStyle? style,
  9. bool quietDeps = false,
  10. bool verbose = false,
  11. bool sourceMap = false,
  12. bool charset = true,
  13. Iterable<Deprecation>? silenceDeprecations,
  14. Iterable<Deprecation>? fatalDeprecations,
  15. Iterable<Deprecation>? futureDeprecations,
})

Like compileToResult, except it runs asynchronously.

Running asynchronously allows this to take AsyncImporters rather than synchronous Importers. However, running asynchronously is also somewhat slower, so compileToResult should be preferred if possible.

Implementation

Future<CompileResult> compileToResultAsync(String path,
        {bool color = false,
        Logger? logger,
        Iterable<AsyncImporter>? importers,
        PackageConfig? packageConfig,
        Iterable<String>? loadPaths,
        Iterable<AsyncCallable>? functions,
        OutputStyle? style,
        bool quietDeps = false,
        bool verbose = false,
        bool sourceMap = false,
        bool charset = true,
        Iterable<Deprecation>? silenceDeprecations,
        Iterable<Deprecation>? fatalDeprecations,
        Iterable<Deprecation>? futureDeprecations}) =>
    c.compileAsync(path,
        logger: logger,
        importCache: AsyncImportCache(
            importers: importers,
            logger: logger ?? Logger.stderr(color: color),
            loadPaths: loadPaths,
            packageConfig: packageConfig),
        functions: functions,
        style: style,
        quietDeps: quietDeps,
        verbose: verbose,
        sourceMap: sourceMap,
        charset: charset,
        silenceDeprecations: silenceDeprecations,
        fatalDeprecations: fatalDeprecations,
        futureDeprecations: futureDeprecations);