WorldContext.loadEncrypted constructor

WorldContext.loadEncrypted({
  1. required String encryptionKey,
  2. String filename = encryptedWorldFilename,
  3. Game? game,
  4. CustomCommandsMap customCommands = const {},
  5. ErrorHandler? errorHandler,
})

Return an instance with its world loaded from an encrypted file.

Implementation

factory WorldContext.loadEncrypted({
  required final String encryptionKey,
  final String filename = encryptedWorldFilename,
  final Game? game,
  final CustomCommandsMap customCommands = const {},
  final ErrorHandler? errorHandler,
}) {
  final sdl = Sdl();
  final world = World.loadEncrypted(
    encryptionKey: encryptionKey,
    filename: filename,
  );
  return WorldContext(
    sdl: sdl,
    game: game ??
        Game(
          'Worldsmith Game',
          triggerMap: world.triggerMap,
        ),
    world: world,
    customCommands: customCommands,
    errorHandler: errorHandler,
  );
}