My intention is to format the name key in an existing Map value.
Supposed the current key value is in UpperCase but I wanted to make it LowerCase
From this
Map<String, String> foo = {
"A" : "valueOne",
"B" : "valueTwo",
};
print(foo); // output: {"A" : "valueOne", "B" : "valueTwo"}
To this
print(foo); // output: {"a" : "valueOne", "b" : "valueTwo"}
Here's the method I tried:
Map<String, String> foo = {
"A" : "valueOne",
"B" : "valueTwo",
};
foo.forEach((key, value) {
key = key.toString().toLowerCase();
value = value;
});
... something something
also tried to assign the forEach as a value
Map<String, String> foo = {
"A" : "valueOne",
"B" : "valueTwo",
};
var bar = foo.forEach((key, value) {
key = key.toString().toLowerCase();
value = value;
});
print(bar); // Failed because forEach Datatype is `void`
... something something
also tried
Map<String, String> foo = {
"A" : "valueOne",
"B" : "valueTwo",
};
foo.forEach((key, value) {
key = key.toString().toLowerCase();
value = value;
Map<String, String> bar = {key: value};
print(bar); // `Output: {a: valueOne} {b: valueTwo}` <- is not what I was looking for.
});
... something something
Any suggestions on what to do Next?