replaceMultipleKind method

Elementary replaceMultipleKind({
  1. required Map<Type, ElementaryBase> kinds,
})

Replace all kinds provide.

If the kind exist already in Elementary components change the value of the map.key for the current value of map.value. You can replace one by one using replaceKind, however if you only want to change a kind in the current context must be recomendated to use Elementary(KindToReplace)Theme.

Usually use in ElementaryAnimatedTheme widget.

Implementation

Elementary replaceMultipleKind({
  required Map<Type, ElementaryBase<dynamic>> kinds,
}) {
  //Check if the component kind exists in the provide theme components
  for (MapEntry<Type, ElementaryBase<dynamic>> kind in kinds.entries) {
    assert(
      components[kind.key]?.runtimeType != null,
      "Kind must be the same Type or Covariant as the replacemente kind",
    );
  }
  //Return copyWith of the [ElementaryThemeData] components must be unmodifiable
  //for being sure of no modifications and no repit hash
  return copyWith(
    components: Map.unmodifiable(Map.from(components)..addAll(kinds)),
  );
}