changeSecret method

Future changeSecret(
  1. File file,
  2. String secret
)

Implementation

Future changeSecret(File file, String secret) async {
  if (await file.exists()) {
    var contents = await file.readAsString();
    contents = contents.replaceAll(RegExp(r'jwt_secret:[^\n]+\n?'), '');
    await file.writeAsString('${contents.trim()}\njwt_secret: "$secret"');
  }
}