writeInsertable method Null safety

  1. @internal
void writeInsertable(
  1. GenerationContext ctx,
  2. Map<String, Expression> map
)

Writes column names and values from the map.

Implementation

@internal
void writeInsertable(GenerationContext ctx, Map<String, Expression> map) {
  final columns = map.keys.map(escapeIfNeeded);

  ctx.buffer
    ..write('(')
    ..write(columns.join(', '))
    ..write(') ')
    ..write('VALUES (');

  var first = true;
  for (final variable in map.values) {
    if (!first) {
      ctx.buffer.write(', ');
    }
    first = false;

    variable.writeInto(ctx);
  }

  ctx.buffer.write(')');
}