safeguardTomlContent method
Implementation
String safeguardTomlContent(String input) {
final lines = input.split('\n');
for (int i = 0; i < lines.length; i++) {
final trimmedLine = lines[i].trimLeft();
if (trimmedLine.startsWith("[ACCOUNTS]")) {
log(
"Replacing [ACCOUNTS] with [[ACCOUNTS]]. The [ACCOUNTS] value is invalid, please contact the issuer of the stellar.toml file and ask them to fix their stellar.toml file.",
name: "stellar_flutter_sdk",
);
lines[i] = lines[i].replaceFirst(
"[ACCOUNTS]",
"[[ACCOUNTS]]",
);
}
if (trimmedLine.startsWith("[[DOCUMENTATION]]")) {
log(
"Replacing [[DOCUMENTATION]] with [DOCUMENTATION]. The [[DOCUMENTATION]] value is invalid, please contact the issuer of the stellar.toml file and ask them to fix their stellar.toml file.",
name: "stellar_flutter_sdk",
);
lines[i] = lines[i].replaceFirst(
"[[DOCUMENTATION]]",
"[DOCUMENTATION]",
);
}
if (trimmedLine.startsWith("[PRINCIPALS]")) {
log(
"Replacing [PRINCIPALS] with [[PRINCIPALS]]. The [PRINCIPALS] value is invalid, please contact the issuer of the stellar.toml file and ask them to fix their stellar.toml file.",
name: "stellar_flutter_sdk",
);
lines[i] = lines[i].replaceFirst(
"[PRINCIPALS]",
"[[PRINCIPALS]]",
);
}
if (trimmedLine.startsWith("[CURRENCIES]")) {
log(
"Replacing [CURRENCIES] with [[CURRENCIES]]. The [CURRENCIES] value is invalid, please contact the issuer of the stellar.toml file and ask them to fix their stellar.toml file.",
name: "stellar_flutter_sdk",
);
lines[i] = lines[i].replaceFirst(
"[CURRENCIES]",
"[[CURRENCIES]]",
);
}
if (trimmedLine.startsWith("[VALIDATORS]")) {
log(
"Replacing [VALIDATORS] with [[VALIDATORS]]. The [VALIDATORS] value is invalid, please contact the issuer of the stellar.toml file and ask them to fix their stellar.toml file.",
name: "stellar_flutter_sdk",
);
lines[i] = lines[i].replaceFirst(
"[VALIDATORS]",
"[[VALIDATORS]]",
);
}
}
return lines.join('\n');
}