NameBuilder class
An on-the-fly name builder.
The builder uses a lazy-building method while capturing all necessary Names to finally construct a complete Namefully instance.
var builder = NameBuilder.of([Name.first('Thomas'), Name.last('Edison')]);
builder.add(Name.middle('Alva'));
print(builder.build()); // 'Thomas Alva Edison'
Other operations such as adding, removing, clearing content are also allowed at any point during the build.
Constructors
- NameBuilder([Name? name])
- Creates a base builder from one Name to construct Namefully later.
-
NameBuilder.of(Iterable<
Name> ? initialNames) - Creates a base builder from many Names to construct Namefully later.
-
NameBuilder.use({Iterable<
Name> ? names, VoidCallback? prebuild, Callback<Namefully, void> ? postbuild, Callback<Namefully, void> ? preclear, VoidCallback? postclear}) - Creates a base builder from many Names with lifecycle hooks.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
postbuild
→ Callback<
Namefully, void> ? -
final
- postclear → VoidCallback?
-
final
- prebuild → VoidCallback?
-
final
-
preclear
→ Callback<
Namefully, void> ? -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → int
-
no setter
Methods
-
add(
Name value) → void -
Adds
value
at the end of the queue.inherited -
addAll(
Iterable< Name> iterable) → void -
Adds all elements of
iterable
at the end of the queue. The length of the queue is extended by the length ofiterable
.inherited -
addFirst(
Name value) → void -
Adds
value
at the beginning of the queue.inherited -
addLast(
Name value) → void -
Adds
value
at the end of the queue.inherited -
build(
[Config? config]) → Namefully - Builds an instance of Namefully from the previously collected names.
-
clear(
) → void - Clears the builder.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
Name value) → bool -
Removes a single instance of
value
from the queue.inherited -
removeFirst(
) → Name? -
Removes and returns the first element of this queue.
inherited
-
removeLast(
) → Name? -
Removes and returns the last element of the queue.
inherited
-
removeWhere(
Callback< Name, bool> test) → void -
Removes all elements matched by
test
from the queue.inherited -
retainWhere(
Callback< Name, bool> test) → void -
Removes all elements not matched by
test
from the queue.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited