compileStringToResultAsync function Compile

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

Like compileStringToResult, except it runs asynchronously.

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

Implementation

Future<CompileResult> compileStringToResultAsync(String source,
        {Syntax? syntax,
        bool color = false,
        Logger? logger,
        Iterable<AsyncImporter>? importers,
        PackageConfig? packageConfig,
        Iterable<String>? loadPaths,
        Iterable<AsyncCallable>? functions,
        OutputStyle? style,
        AsyncImporter? importer,
        Object? url,
        bool quietDeps = false,
        bool verbose = false,
        bool sourceMap = false,
        bool charset = true,
        Iterable<Deprecation>? silenceDeprecations,
        Iterable<Deprecation>? fatalDeprecations,
        Iterable<Deprecation>? futureDeprecations}) =>
    c.compileStringAsync(source,
        syntax: syntax,
        logger: logger,
        importCache: AsyncImportCache(
            importers: importers,
            logger: logger ?? Logger.stderr(color: color),
            packageConfig: packageConfig,
            loadPaths: loadPaths),
        functions: functions,
        style: style,
        importer: importer,
        url: url,
        quietDeps: quietDeps,
        verbose: verbose,
        sourceMap: sourceMap,
        charset: charset,
        silenceDeprecations: silenceDeprecations,
        fatalDeprecations: fatalDeprecations,
        futureDeprecations: futureDeprecations);