encode method

  1. @mustCallSuper
void encode(
  1. KeyedArchive object
)
override

Implementation

@mustCallSuper
void encode(KeyedArchive object) {
  final invalidKeys = extensions.keys
      .where((key) => !key.startsWith("x-"))
      .map((key) => "'$key'")
      .toList();
  if (invalidKeys.length > 0) {
    throw ArgumentError(
        "extension keys must start with 'x-'. The following keys are invalid: ${invalidKeys.join(", ")}");
  }

  extensions.forEach((key, value) {
    object.encode(key, value);
  });
}