compileAsync function Null safety Compile

  1. @Deprecated("Use compileToResultAsync() instead.")
Future<String> compileAsync(
  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. @Deprecated("Use CompileResult.sourceMap from compileToResultAsync() instead.") void sourceMap(
    1. SingleMapping map
    )?}
)

Like compile, except it runs asynchronously.

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

Implementation

@Deprecated("Use compileToResultAsync() instead.")
Future<String> compileAsync(
    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,
    @Deprecated("Use CompileResult.sourceMap from compileToResultAsync() instead.")
        void sourceMap(SingleMapping map)?}) async {
  var result = await compileToResultAsync(path,
      logger: logger,
      importers: importers,
      loadPaths: loadPaths,
      packageConfig: packageConfig,
      functions: functions,
      style: style,
      quietDeps: quietDeps,
      verbose: verbose,
      sourceMap: sourceMap != null);
  result.sourceMap.andThen(sourceMap);
  return result.css;
}