setConfigDefaults function

Future<void> setConfigDefaults(
  1. Map<String, Object?> defaults
)

Sets the values a key reads as before any fetch has succeeded.

That is most of an appliance's life: a device that cannot reach the network still has to behave.

Implementation

Future<void> setConfigDefaults(Map<String, Object?> defaults) {
  final encoded = encodeVariant(defaults);
  final buf = calloc<Uint8>(encoded.isEmpty ? 1 : encoded.length);
  buf.asTypedList(encoded.length).setAll(0, encoded);
  return _awaitOutcome(
    (port) => fdbRcSetDefaults(buf, encoded.length, port),
    'setConfigDefaults',
  ).whenComplete(() => calloc.free(buf));
}