String encryptString(String str)

encrypt the string and prefix the value with '\u001Bpw:' so it's compatible with old plain text password

Source

static String encryptString(String str) {
  if (str == '') {
    return '';
  }
  _encryptEngine.reset();
  _encryptEngine.init(true, _encryptParams);

  Uint8List utf8bytes = UTF8.encode(str);
  Uint8List block = new Uint8List((utf8bytes.length + 31 )~/32 * 32);
  block.setRange(0, utf8bytes.length, utf8bytes);
  return '\u001Bpw:${Base64.encode(_encryptEngine.process(block))}';
}