Skip to content

feat: Flutter SDK update for version 24.1.0#310

Merged
ArnabChatterjee20k merged 6 commits into
mainfrom
dev
May 19, 2026
Merged

feat: Flutter SDK update for version 24.1.0#310
ArnabChatterjee20k merged 6 commits into
mainfrom
dev

Conversation

@ArnabChatterjee20k
Copy link
Copy Markdown
Member

@ArnabChatterjee20k ArnabChatterjee20k commented May 18, 2026

This PR contains updates to the Flutter SDK for version 24.1.0.

What's Changed

  • Added: Realtime presences channel and RealtimePresence types for presence subscriptions
  • Added: Advisor and Presences services
  • Added: Insight, Presence, and Report models with list variants
  • Added: fusionauth, keycloak, and kick providers to OAuthProvider enum
  • Updated: X-Appwrite-Response-Format header to 1.9.5

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 18, 2026

Greptile Summary

This PR delivers the Flutter SDK 24.1.0 update, adding Advisor and Presences REST services, new Insight, InsightCTA, Report, Presence models with list variants, a realtime presences channel with fire-and-forget upsertPresence, three new OAuth providers, a setCookie helper, and the corresponding X-Appwrite-Response-Format: 1.9.5 bump. It also fixes a long-standing data-field fallback bug in Document and Row that would leak the full response map into data when the field was absent.

  • New services & models: Advisor (list/get reports and insights) and Presences (CRUD) are added as part files, complete with tests; all new models follow the established fromMap/toMap/toString conventions with one exception (see inline comment on InsightCTA.params).
  • Realtime presence: upsertPresenceTo in RealtimeMixin queues the latest payload in _pendingPresence and flushes it only after the application-level connected handshake (_appConnected gate), correctly re-sending on reconnect and clearing on disconnect().

Confidence Score: 4/5

Safe to merge after fixing the InsightCTA params deserialization; every other changed path looks correct.

In InsightCTA.fromMap, params is assigned directly from the raw map without a type cast. Because Dart's jsonDecode produces Map<dynamic, dynamic>, assigning it to the non-nullable Map<String, dynamic> field throws a TypeError at runtime whenever an insight with a CTA is deserialized — which is the primary use-case of the new Advisor service.

lib/src/models/insight_cta.dart — the params field deserialization needs Map<String, dynamic>.from(map['params'] ?? {})

Important Files Changed

Filename Overview
lib/src/models/insight_cta.dart New model; params is assigned without type cast, causing a TypeError at runtime when deserializing JSON
lib/src/models/presence.dart New Presence model; metadata fallback correctly uses Map<String, dynamic>.from(map["metadata"] ?? {})
lib/src/realtime_mixin.dart Adds upsertPresenceTo with _pendingPresence state and _appConnected gate; fire-and-forget with correct reconnect re-send semantics
lib/services/presences.dart New Presences service; CRUD operations look correct and consistent with existing service patterns
lib/services/advisor.dart New Advisor service; list/get operations for Reports and Insights are correct
lib/src/models/document.dart Fixed data fallback from map to {} to prevent the entire response map leaking into the data field
lib/channel.dart Adds _Presence channel type and PresenceChannel extension with create/upsert/update/delete actions

Reviews (2): Last reviewed commit: "Commit from GitHub Actions (Format and p..." | Re-trigger Greptile

Comment thread lib/src/models/presence.dart Outdated
Comment thread test/src/models/presence_test.dart
Comment thread lib/src/client_io.dart
Comment on lines 243 to 246
} catch (e) {
debugPrint('Error getting device info: $e');
device = Platform.operatingSystem;
addHeader('user-agent', device);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 The debugPrint call was removed from the catch block, so any failure to retrieve device info is now completely silent. The fallback code still runs, but engineers lose all visibility into when and why this path is taken.

Suggested change
} catch (e) {
debugPrint('Error getting device info: $e');
device = Platform.operatingSystem;
addHeader('user-agent', device);
}
} catch (e) {
debugPrint('Error getting device info: $e');
device = Platform.operatingSystem;
addHeader('user-agent', device);
}

label: map['label'].toString(),
service: map['service'].toString(),
method: map['method'].toString(),
params: map['params'],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 params is assigned directly from the raw map as dynamic with no type cast or null guard. Because jsonDecode produces Map<dynamic, dynamic> (not Map<String, dynamic>), the runtime assignment to the non-nullable Map<String, dynamic> params field will throw a TypeError. Every other Map-typed field in the new models (e.g. Presence.metadata) uses Map<String, dynamic>.from(... ?? {}) for exactly this reason.

Suggested change
params: map['params'],
params: Map<String, dynamic>.from(map['params'] ?? {}),

@ArnabChatterjee20k ArnabChatterjee20k merged commit 25d610b into main May 19, 2026
1 check passed
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.

3 participants