Использование replaceFirst
может заставить вас хотеть.
main() {
String test = "\"test\" //Example//";
final Map<String, List<String>> map = {
"\"": ["< b >", "< \/b >"],
"//": ["< i >", "< /i >"]
};
map.forEach((key, mapping) {
test = test.replaceFirst(key, mapping[0]);
test = test.replaceFirst(key, mapping[1]);
});
print(test);
}