Skip to content

Commit

Permalink
fix: ensure session id is a string and handle empty values
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielRStabile committed Dec 17, 2024
1 parent a0679f3 commit e37936e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/src/posthog_flutter_web_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ Future<dynamic> handleWebMethodCall(MethodCall call, JsObject context) async {
]);
break;
case 'getSessionId':
final sessionId = analytics.callMethod('get_session_id');
final sessionId = analytics.callMethod('get_session_id')?.toString();

if (sessionId?.isEmpty == true) return null;

return sessionId;
case 'flush':
// not supported on Web
Expand Down

0 comments on commit e37936e

Please sign in to comment.