writeFileImports method

  1. @override
void writeFileImports(
  1. DartOptions generatorOptions,
  2. Root root,
  3. Indent indent, {
  4. required String dartPackageName,
})
override

Writes specified imports to indent.

Implementation

@override
void writeFileImports(
  DartOptions generatorOptions,
  Root root,
  Indent indent, {
  required String dartPackageName,
}) {
  indent.writeln("import 'dart:async';");
  indent.writeln(
    "import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;",
  );
  indent.newln();

  final bool hasProxyApi = root.apis.any((Api api) => api is AstProxyApi);
  indent.writeln(
      "import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer${hasProxyApi ? ', immutable, protected' : ''};");
  indent.writeln("import 'package:flutter/services.dart';");
  if (hasProxyApi) {
    indent.writeln(
      "import 'package:flutter/widgets.dart' show WidgetsFlutterBinding;",
    );
  }
}