Skip to content

Feat: LF-166 LF-168 Add flutter web iframe contract package#514

Open
kumalg wants to merge 8 commits intomasterfrom
feature/flutter-web-iframe-contract
Open

Feat: LF-166 LF-168 Add flutter web iframe contract package#514
kumalg wants to merge 8 commits intomasterfrom
feature/flutter-web-iframe-contract

Conversation

@kumalg
Copy link

@kumalg kumalg commented Mar 10, 2026

No description provided.

@kumalg kumalg changed the title Feat: Add flutter web iframe contract package Feat: LF-166 LF-168 Add flutter web iframe contract package Mar 10, 2026
@kumalg kumalg marked this pull request as ready for review March 10, 2026 13:41
flutter: '>=3.24.0'

dependencies:
bloc: ^8.1.4
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't support the latest 9.* versions

Comment on lines +5 to +11
class UrlParamsBase {
/// The contract version extracted from the URL query parameters, if present.
String? get contractVersion => params[contractVersionQueryKey];

/// All query parameters from the current URL.
Map<String, String> get params => Uri.base.queryParameters;
}
Copy link
Member

Choose a reason for hiding this comment

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

Let's make these properties static, and the class itself abstract final

@@ -0,0 +1,43 @@
/// Base state for the host connection lifecycle.
sealed class ConnectToHostState<THostMethods> {
Copy link
Member

Choose a reason for hiding this comment

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

Cubit & bloc state should have value-based equatability (package:equatable)

Comment on lines +81 to +82
final cached = _cachedConnection;
if (cached != null) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
final cached = _cachedConnection;
if (cached != null) {
if (_cachedConnection case final cached?) {

Comment on lines +21 to +22
matrix:
flutter_version: ['3.24.x']
Copy link
Member

Choose a reason for hiding this comment

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

Let's also test against the latest version (3.41)

const String contractVersionQueryKey = 'contractVersion';

/// Base class for accessing URL query parameters from [Uri.base].
abstract class UrlParamsBase {
Copy link
Member

Choose a reason for hiding this comment

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

Make final

import 'package:equatable/equatable.dart';

/// Base state for the host connection lifecycle.
sealed class ConnectToHostState<THostMethods> extends Equatable {
Copy link
Member

Choose a reason for hiding this comment

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

Use EquatableMixin instead

strategy:
fail-fast: false
matrix:
flutter_version: ['3.41']
Copy link
Member

Choose a reason for hiding this comment

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

Since the package claims to support Flutter 3.24+, let's also test that version (i.e. the version that was here before)

ConnectToHostCubitOptions<TRemoteMethods, THostMethods> options,
) : _options = options,
super(ConnectToHostIdle<THostMethods>()) {
_connect();
Copy link
Member

Choose a reason for hiding this comment

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

I'd move the initialization out of the constructor (and invoke it where the cubit is created)

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.

2 participants