compileStringAsync function Null safety Compile

  1. @Deprecated("Use compileStringToResultAsync() instead.")
Future<String> compileStringAsync(
  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. @Deprecated("Use CompileResult.sourceMap from compileStringToResultAsync() instead.") void sourceMap(
    1. SingleMapping map
    )?,
  15. bool charset = true,
  16. @Deprecated("Use syntax instead.") bool indented = false}
)

Like compileString, except it runs asynchronously.

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

Implementation

@Deprecated("Use compileStringToResultAsync() instead.")
Future<String> compileStringAsync(
    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,
    @Deprecated("Use CompileResult.sourceMap from compileStringToResultAsync() instead.")
        void sourceMap(SingleMapping map)?,
    bool charset = true,
    @Deprecated("Use syntax instead.")
        bool indented = false}) async {
  var result = await compileStringToResultAsync(source,
      syntax: syntax ?? (indented ? Syntax.sass : Syntax.scss),
      logger: logger,
      importers: importers,
      packageConfig: packageConfig,
      loadPaths: loadPaths,
      functions: functions,
      style: style,
      importer: importer,
      url: url,
      quietDeps: quietDeps,
      verbose: verbose,
      sourceMap: sourceMap != null,
      charset: charset);
  result.sourceMap.andThen(sourceMap);
  return result.css;
}