Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(configurator): Fix configurator web unsupported error #105

Merged
merged 1 commit into from
Oct 23, 2024

Conversation

riscait
Copy link
Member

@riscait riscait commented Oct 22, 2024

πŸ”— Issue Link

closes #14

πŸ™Œ What I did

✍️ What I didn't do

βœ… Verification

  • Android
  • iOS
  • macOS
  • Web

Screenshots

Additional Information

@@ -5,19 +5,19 @@ import 'dart:async';
class Config<T> {
Config({
required T value,
required StreamSubscription<void> subscription,
required StreamSubscription<void>? subscription,
Copy link
Member Author

@riscait riscait Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this.subscription would be fine, but I'm wondering if you're purposely assigning it to _subscription to keep it from being accessed externally.

Probably so, so it is left as is.

Suggested change
required StreamSubscription<void>? subscription,
this.subscription,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was probably intending that!

@@ -1,18 +1,19 @@
import 'dart:convert';

import 'package:firebase_remote_config/firebase_remote_config.dart';
import 'package:meta/meta.dart';
import 'package:flutter/foundation.dart';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to use kIsWeb and made explicit the dependency on Flutter in pubspec as well!


import 'config.dart';

typedef ValueChanged<T> = void Function(T value);
typedef _ValueChanged<T> = void Function(T value);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it private because it seems to be used only within this file.

Comment on lines +124 to +129
subscription: kIsWeb || onConfigUpdated == null
? null
: filteredOnConfigUpdated(key).listen((event) async {
await activate();
onConfigUpdated(getString(key));
}),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Register subscriptions only when not on the web and onConfigUpdated is not null!

@riscait riscait marked this pull request as ready for review October 22, 2024 12:25
@riscait riscait requested a review from a team as a code owner October 22, 2024 12:25
@riscait riscait requested review from naipaka and removed request for a team October 22, 2024 12:25
Copy link
Contributor

@naipaka naipaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thank you for your PR!

@@ -5,19 +5,19 @@ import 'dart:async';
class Config<T> {
Config({
required T value,
required StreamSubscription<void> subscription,
required StreamSubscription<void>? subscription,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was probably intending that!

@riscait riscait merged commit 8cf7de9 into main Oct 23, 2024
5 checks passed
@riscait riscait deleted the #14-fix-web-unsupported-error-for-configurator branch October 23, 2024 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: Unsupported operation: onConfigUpdated is not supported for web
2 participants