encode method

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

Implementation

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

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