''Unable to fetch remote config. Cached or default values will be 'used' flutter

I have setup firebase config for flutter

According to documentation https://pub.dev/packages/firebase_remote_config#-readme-tab-

My key is

enter image description here

then I have Published also then i tried following code and it will return

'Unable to fetch remote config. Cached or default values will be ''used'

could you please point issue

I have tried those also

Firebase Remote Config - Initial fetch return local default values

Remote config in Flutter app throws exception on fetch

try {
              remoteConfig.getString('welcome')[![enter image description here][1]][1]
              // Using default duration to force fetching from remote server.
              await remoteConfig.fetch(expiration: const Duration(seconds: 0));
              await remoteConfig.activateFetched();
     } on FetchThrottledException catch (exception) {
              // Fetch throttled.
              print(exception);
    } catch (exception) {
              print(
                  'Unable to fetch remote config. Cached or default values will be '
                  'used');
}


Solution 1:[1]

This worked fine for me,

    await remoteConfig.ensureInitialized();

Solution 2:[2]

Usually when you fight these problems, in the end, everything gets mixed up. I think after the post you could already see the configured value, but the error occurs when querying another parameter name. Add the following line to see the actual error you are getting.

print('EXCEPTION: $exception');

try {
      await remoteConfig.fetch(expiration: const Duration(seconds: 0));
      await remoteConfig.activateFetched();
      String forceUpdateCurrentVersion =
          remoteConfig.getString('force_update_current_version');
      double newVersion =
          double.parse(forceUpdateCurrentVersion.trim().replaceAll(".", ""));
      if (newVersion > currentVersion) {
        _showVersionDialog(context);
      }
    } on FetchThrottledException catch (exception) {
      // Fetch throttled.
      print(exception);
    } catch (exception) {
      print('EXCEPTION: $exception');
      print('Unable to fetch remote config. Cached or default values will be '
          'used');
    }

Solution 3:[3]

Just put value don't put braces for Default value

For Example

enter image description here

Then use below code in flutter

remoteConfig.getString('IT_');

Solution 4:[4]

If you are using Android emulator, ensure it has Google play services enabled.

Solution 5:[5]

it's work for me

  FirebaseRemoteConfig remoteConfig = FirebaseRemoteConfig.instance;

  initializeRemote() async {
    // remoteConfig = await setupRemoteConfig();
    bool updated = await remoteConfig.fetchAndActivate();
    if (updated) {
      print("found");
      // the config has been updated, new parameter values are available.
    } else {
      print("not print");
      // the config values were previously updated.
    }
    await remoteConfig.ensureInitialized().then((value) async {
      print("remote value -> ${await remoteConfig.getString("app_version")}");

    });
  }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Pablo Crucitta
Solution 3 Nandakishor Dhanaji Valakunde
Solution 4 Tayo.dev
Solution 5 Rasel Khan