0

I have one String type variable API_URL in flutter and I want to get its value from Firebase Remote Config. I wrote following code to fetch it...

Future<String> get_api_url() async {
  final RemoteConfig remoteConfig = await RemoteConfig.instance;
  await remoteConfig.fetch(expiration: const Duration(hours: 0));
  await remoteConfig.activateFetched();
  return remoteConfig.getString('api_url');
}

It is returning value but I am not able to store it in variable named API_URL. May be I can use FutureBuilder but not sure what to do. So your help will be much appreciated.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441

0 Answers0