Skip to content

[firebase_remote_config]: When restarting the app, firebase_remote_config listener stream subscription is not canceled, resulting in duplicate calls. #17955

@kimdindoo

Description

@kimdindoo

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Remote Config

Which platforms are affected?

iOS

Description

When restarting the app, firebase_remote_config listener stream subscription is not canceled, resulting in duplicate calls.

Reproducing the issue

  void _registerRemoteConfigListener() {
    if (_remoteConfigSubscription != null) return; // 이미 등록되어 있으면 재등록 방지
    final remoteConfig = getIt.get<FirebaseRemoteConfig>();
    _remoteConfigSubscription = remoteConfig.onConfigUpdated.listen((event) async {
      await remoteConfig.activate();

      debugPrint('event: ${event}');
      debugPrint('event.updatedKeys: ${event.updatedKeys}');

      serverVersion = GlobalVars.platformOS == 'iPhone'
          ? remoteConfig.getString('Test_Flutter_IOS_BuildNumber')
          : remoteConfig.getString('Test_Flutter_AOS_BuildNumber');
      String currentBuildNumber = getIt.get<PackageInfo>().buildNumber;

      debugPrint('[remote config listener] 서버버전: $serverVersion');
      debugPrint('[remote config listener] 현재버전: $currentBuildNumber');

    });
  }
  @override
  void dispose() {
    WidgetsBinding.instance.removeObserver(this);
    _linkSubscription?.cancel();
    _remoteConfigSubscription?.cancel(); // 실시간 리스너 구독 해제
    _remoteConfigSubscription = null;
    super.dispose();
  }

Firebase Core version

4.3.0

Flutter Version

3.38.6

Relevant Log Output

Flutter dependencies

Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.

Additional context and comments

(#12539)

Same situation as the issue above

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions