Having issue with storing data using flutter secure storage. Issue is seen only when I host the release web build with some server (like apache2). While runing the app using flutter run -d chrome, it is working fine. Also the release version for iOS and android versions are working fine.

The issue I am getting is: NoSuchMethodError: method not found: 'generateKey' on null

Code:

if (isMasterPasswordCorrect == true) {
                                        print(
                                            'master password is correct-----');
                                        print(masterPasswordController.text);
                                        final secureStorage =
                                            new FlutterSecureStorage();
                                        try {
                                          print(
                                              'writing master password data into secure storage');
                                          await secureStorage.write(
                                              key: 'masterPassword',
                                              value: masterPasswordController
                                                  .text);
                                          print(
                                              'reading master password from secure storage');
                                          _isMasterPasswordPresent =
                                              await secureStorage.read(
                                                  key: 'masterPassword');

                                          print(
                                              '${_isMasterPasswordPresent}');
                                        } catch (e) {
                                          print(e);
                                        }
}

Output

main.dart.js:21714 master password is correct-----
main.dart.js:21714 14000
main.dart.js:21714 writing master password data into secure storage
main.dart.js:21714 NoSuchMethodError: method not found: 'generateKey' on null
0

There are 0 best solutions below