build method Null safety

  1. @override
Future<void> build(
  1. BuildStep buildStep
)
override

Generates the outputs for a given BuildStep.

Implementation

@override
Future<void> build(BuildStep buildStep) async {
  final stopwatch = Stopwatch();
  stopwatch.start();

  final libraryReader = LibraryReader(await buildStep.inputLibrary);
  final fieldses = await sqliteFieldsFromBuildStep(buildStep);
  final output = schemaGenerator.generate(libraryReader, fieldses);

  await manuallyUpsertAppFile('db/schema.g.dart', output);
  await buildStep.writeAsString(buildStep.inputId.changeExtension(outputExtension), output);
  logStopwatch('Generated db/schema.g.dart', stopwatch);
}