Config class abstract

The Configuration to use across the other components.

The multiton pattern is used to keep one configuration across the Namefully setup. This is useful for avoiding confusion when building other components such as FirstName, LastName, or Name of distinct types (or Namon) that may be of particular shapes.

For example, a person's FullName may appear by:

Config makes it easy to set up a specific configuration for Namefully and reuse it through other instances or components along the way. If a new Config is needed, a named configuration may be created. It is actually advised to use named Config(name) instead as it may help mitigate issues and avoid confusion and ambiguity in the future. Plus, a named configuration explains its purpose.

var defaultConfig = Config();
var otherConfig = Config(name: 'other', title: Title.us);
var mergedConfig = Config.merge(otherConfig);
var copyConfig = mergedConfig.copyWith(ending: true);

Additionally, a configuration may be merged with or copied from an existing configuration, prioritizing the new one's values.

Constructors

Config({String name, NameOrder? orderedBy, Separator? separator, Title? title, bool? ending, bool? bypass, Surname? surname})
Returns a unified version of default values of the configuration and the optional values to consider.
factory
Config.byLastName({Surname? surname, Separator? separator})
Returns a last name-based configuration.
factory
Config.merge(Config? other)
Returns a combined version of the existing values of the default configuration and the provided values of another configuration.
factory

Properties

bypass bool
A bypass of the validation rules with this option. This option is ideal to avoid checking their validity.
no setter
ending bool
The option indicating if an ending suffix is used in a formal way.
no setter
hashCode int
The hash code for this object.
no setterinherited
name String
The name of the cached configuration.
no setter
orderedBy NameOrder
The order of appearance of a full name.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
separator Separator
The token used to indicate how to split string values.
no setter
surname Surname
An option indicating how to format a surname.
no setter
title Title
The abbreviation type to indicate whether or not to add period to a prefix using the American or British way.
no setter

Methods

clone() Config
Makes an exact copy of the current configuration.
copyWith({String? name, NameOrder? orderedBy, Separator? separator, Title? title, bool? ending, bool? bypass, Surname? surname}) Config
Returns a copy of this configuration merged with the provided values.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Resets the configuration by setting it back to its default values.
toString() String
A string representation of this object.
inherited
updateOrder(NameOrder nameOrder) → void
Alters the nameOrder between the first and last name, and rearrange the order of appearance of a name set.

Operators

operator ==(Object other) bool
The equality operator.
inherited