0
votes

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');
}
4

4 Answers

0
votes

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');
    }
0
votes

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_');

0
votes

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

0
votes

This worked fine for me,

    await remoteConfig.ensureInitialized();