SchemaPatterns extension

Adds pattern-matching-related methods to Schema.

on

Methods

map<TResult extends Object?>({required TResult object(SchemaObject value), required TResult boolean(SchemaBoolean value), required TResult string(SchemaString value), required TResult integer(SchemaInteger value), required TResult number(SchemaNumber value), required TResult enumeration(SchemaEnum value), required TResult array(SchemaArray value), required TResult map(SchemaMap value)}) → TResult

Available on Schema, provided by the SchemaPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>({TResult? object(SchemaObject value)?, TResult? boolean(SchemaBoolean value)?, TResult? string(SchemaString value)?, TResult? integer(SchemaInteger value)?, TResult? number(SchemaNumber value)?, TResult? enumeration(SchemaEnum value)?, TResult? array(SchemaArray value)?, TResult? map(SchemaMap value)?}) → TResult?

Available on Schema, provided by the SchemaPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>({TResult object(SchemaObject value)?, TResult boolean(SchemaBoolean value)?, TResult string(SchemaString value)?, TResult integer(SchemaInteger value)?, TResult number(SchemaNumber value)?, TResult enumeration(SchemaEnum value)?, TResult array(SchemaArray value)?, TResult map(SchemaMap value)?, required TResult orElse()}) → TResult

Available on Schema, provided by the SchemaPatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>({TResult object(String? title, String? description, dynamic defaultValue, String? ref, List<Schema>? allOf, List<Schema>? oneOf, List<Schema>? anyOf, List<String>? required, Discriminator? discriminator, ExternalDocs? externalDocs, Map<String, Schema>? properties, bool? nullable, Xml? xml)?, TResult boolean(Xml? xml, String? title, String? description, bool? defaultValue, bool? nullable, bool? example, String? ref)?, TResult string(Xml? xml, String? title, String? description, String? defaultValue, bool? nullable, StringFormat? format, String? pattern, String? example, int? minLength, int? maxLength, int? exclusiveMinimum, int? exclusiveMaximum, String? ref)?, TResult integer(Xml? xml, String? title, String? description, int? defaultValue, bool? nullable, IntegerFormat? format, int? example, int? minimum, int? maximum, int? exclusiveMinimum, int? exclusiveMaximum, int? multipleOf, String? ref)?, TResult number(Xml? xml, String? title, String? description, double? defaultValue, bool? nullable, NumberFormat? format, double? example, double? minimum, double? maximum, int? exclusiveMinimum, int? exclusiveMaximum, double? multipleOf, String? ref)?, TResult enumeration(String? title, String? description, String? example, String? defaultValue, bool? nullable, String? unknownValue, List<String>? values, String? ref)?, TResult array(Xml? xml, String? title, String? description, List? defaultValue, bool? nullable, dynamic example, int? minItems, int? maxItems, Schema items, String? ref)?, TResult map(Xml? xml, String? title, String? description, Map? defaultValue, bool? nullable, Map? example, Schema? valueSchema, String? ref)?, required TResult orElse()}) → TResult

Available on Schema, provided by the SchemaPatterns extension

A variant of when that fallback to an orElse callback.
when<TResult extends Object?>({required TResult object(String? title, String? description, dynamic defaultValue, String? ref, List<Schema>? allOf, List<Schema>? oneOf, List<Schema>? anyOf, List<String>? required, Discriminator? discriminator, ExternalDocs? externalDocs, Map<String, Schema>? properties, bool? nullable, Xml? xml), required TResult boolean(Xml? xml, String? title, String? description, bool? defaultValue, bool? nullable, bool? example, String? ref), required TResult string(Xml? xml, String? title, String? description, String? defaultValue, bool? nullable, StringFormat? format, String? pattern, String? example, int? minLength, int? maxLength, int? exclusiveMinimum, int? exclusiveMaximum, String? ref), required TResult integer(Xml? xml, String? title, String? description, int? defaultValue, bool? nullable, IntegerFormat? format, int? example, int? minimum, int? maximum, int? exclusiveMinimum, int? exclusiveMaximum, int? multipleOf, String? ref), required TResult number(Xml? xml, String? title, String? description, double? defaultValue, bool? nullable, NumberFormat? format, double? example, double? minimum, double? maximum, int? exclusiveMinimum, int? exclusiveMaximum, double? multipleOf, String? ref), required TResult enumeration(String? title, String? description, String? example, String? defaultValue, bool? nullable, String? unknownValue, List<String>? values, String? ref), required TResult array(Xml? xml, String? title, String? description, List? defaultValue, bool? nullable, dynamic example, int? minItems, int? maxItems, Schema items, String? ref), required TResult map(Xml? xml, String? title, String? description, Map? defaultValue, bool? nullable, Map? example, Schema? valueSchema, String? ref)}) → TResult

Available on Schema, provided by the SchemaPatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>({TResult? object(String? title, String? description, dynamic defaultValue, String? ref, List<Schema>? allOf, List<Schema>? oneOf, List<Schema>? anyOf, List<String>? required, Discriminator? discriminator, ExternalDocs? externalDocs, Map<String, Schema>? properties, bool? nullable, Xml? xml)?, TResult? boolean(Xml? xml, String? title, String? description, bool? defaultValue, bool? nullable, bool? example, String? ref)?, TResult? string(Xml? xml, String? title, String? description, String? defaultValue, bool? nullable, StringFormat? format, String? pattern, String? example, int? minLength, int? maxLength, int? exclusiveMinimum, int? exclusiveMaximum, String? ref)?, TResult? integer(Xml? xml, String? title, String? description, int? defaultValue, bool? nullable, IntegerFormat? format, int? example, int? minimum, int? maximum, int? exclusiveMinimum, int? exclusiveMaximum, int? multipleOf, String? ref)?, TResult? number(Xml? xml, String? title, String? description, double? defaultValue, bool? nullable, NumberFormat? format, double? example, double? minimum, double? maximum, int? exclusiveMinimum, int? exclusiveMaximum, double? multipleOf, String? ref)?, TResult? enumeration(String? title, String? description, String? example, String? defaultValue, bool? nullable, String? unknownValue, List<String>? values, String? ref)?, TResult? array(Xml? xml, String? title, String? description, List? defaultValue, bool? nullable, dynamic example, int? minItems, int? maxItems, Schema items, String? ref)?, TResult? map(Xml? xml, String? title, String? description, Map? defaultValue, bool? nullable, Map? example, Schema? valueSchema, String? ref)?}) → TResult?

Available on Schema, provided by the SchemaPatterns extension

A variant of when that fallback to returning null