问题描述
我在Flutter中有一个String类型变量API_URL,我想从Firebase Remote Config中获取其值。我写了以下代码来获取它...
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');
}
它正在返回值,但是我无法将其存储在名为API_URL的变量中。也许我可以使用FutureBuilder,但不确定该怎么做。因此,非常感谢您的帮助。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)