write method

  1. @override
void write ()
override

Implementation

@override
void write() {
  // First, write the static generor function
  StaticFunctionWriter(database, target, indent).write();

  /*
			class _$MyDatabaseImpl extends MyDatabase implements GeneratedDatabaseImpl {

				Database database;

				// all the generated methods
			}
		 */

  final originalClassName = database.clazz.displayName;
  final implClassName = database.nameOfImplementationClass;

  writeLineWithIndent(
      "class $implClassName extends $originalClassName implements GeneratedDatabaseImpl {");
  writeLineWithIndent("Database database;", 1);

  for (final operation in database.operations) {
    OperationWriter(operation, context, target, indent + 1).write();
  }

  writeLineWithIndent("}");
}