insertBeforeLastBrace static method
Implementation
static Future<void> insertBeforeLastBrace(String filePath, String content) async {
final file = File(filePath);
var text = await file.readAsString();
final lastBrace = text.lastIndexOf('}');
if (lastBrace == -1) return;
text = text.substring(0, lastBrace) + content + text.substring(lastBrace);
await file.writeAsString(text);
}