server static method

Future<void> server(
  1. FutureOr<void> configurator(
    1. PrismaDevelopment
    )
)

Prisma development environment server.

Implementation

static Future<void> server(
  FutureOr<void> Function(PrismaDevelopment) configurator,
) async {
  final PrismaDevelopment development = PrismaDevelopment._internal();

  // Calls the configurator.
  await configurator(development);

  // Create encoded environment.
  final String encoded =
      base64.encode(utf8.encode(json.encode(development._environment)));

  // Print the start keyword.
  printToConsole(_start);

  // Add encoded environment. split into multiple lines.
  // line length is 80 characters.
  for (int i = 0; i < encoded.length; i += _lineMaxLength) {
    int end = i + _lineMaxLength;
    if (end > encoded.length) {
      end = encoded.length;
    }

    printToConsole(encoded.substring(i, end));
  }

  // Write end keyword.
  printToConsole(_end);
}