set method
void
set(
- dynamic args
Parses input data and stores them as key: value pair. Can store any type of data - Map, Iterable, Objects and more.. Map - is directly added to data store. Iterable - is parsed and data are stored under their Type. Object - is stored under his Type. Other ControlArgs is combined.
Implementation
void set(dynamic args) {
if (args == null) {
return;
}
if (args is ControlArgs) {
combine(args);
} else if (args is Map) {
_args.addAll(args);
} else if (args is Set) {
args.forEach((item) {
_args[item.runtimeType] = item;
});
} else if (args is Iterable) {
if (args.length > 1 &&
args.every(
(element) => element.runtimeType == args.first.runtimeType)) {
_args[args.runtimeType] = args;
} else {
args.forEach((item) {
_args[item.runtimeType] = item;
});
}
} else {
_args[args.runtimeType] = args;
}
}