createType function

Type createType({
  1. String name = '<missing name>',
  2. String aliasOfName = "",
  3. Type? arrayOf,
  4. Type? optionalOf,
  5. void serialize(
    1. Type self,
    2. SerialBuffer buffer,
    3. dynamic data, {
    4. required bool allowExtensions,
    5. SerializerState? state,
    })?,
  6. dynamic deserialize(
    1. Type self,
    2. SerialBuffer buffer, {
    3. required bool allowExtensions,
    4. SerializerState? state,
    })?,
  7. String baseName = "",
  8. List<Field> fields = const [],
  9. Type? extensionOf,
})

Implementation

Type createType({
  String name = '<missing name>',
  String aliasOfName = "",
  Type? arrayOf,
  Type? optionalOf,
  void Function(
    Type self,
    SerialBuffer buffer,
    dynamic data, {
    SerializerState? state,
    required bool allowExtensions,
  })?
      serialize,
  dynamic Function(
    Type self,
    SerialBuffer buffer, {
    SerializerState? state,
    required bool allowExtensions,
  })?
      deserialize,
  String baseName: "",
  List<Field> fields: const [],
  Type? extensionOf,
}) {
  var t = Type(
      aliasOfName: aliasOfName,
      name: name,
      arrayOf: arrayOf,
      optionalOf: optionalOf,
      extensionOf: extensionOf,
      base: null,
      baseName: baseName,
      fields: fields,
      serialize: serialize,
      deserialize: deserialize);

  return t;
}