encode method
List<int>
encode(
- Object? input, {
- Object? toEncodable(
- dynamic object
- BjdataConfig? config,
override
Converts value to a BJData buffer.
If value contains objects that are not directly encodable to BJData
(a value that is not a number, boolean, string, null, list or a map
with string keys), the toEncodable function is used to convert it to an
object that must be directly encodable.
If toEncodable is omitted, it defaults to a function that returns the
result of calling .toJson() on the unencodable object.
Lists that are uniform tables of records are written as Structure-of-Arrays
containers rather than arrays of objects, as directed by config.
Implementation
@override
List<int> encode(
Object? input, {
Object? Function(dynamic object)? toEncodable,
BjdataConfig? config,
}) {
toEncodable ??= _toEncodable;
config ??= _config;
if (toEncodable == null && config == _config) return encoder.convert(input);
return BjdataEncoder(toEncodable, null, config).convert(input);
}