chatwoot / chatwoot/chatwoot-flutter-sdk

Unable to use ChatwootChat-Widget without a ChatwootUser

Open
#52 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
85
Forks
165
PR merge metrics
No merged PRs in 30d

Description

Using the `ChatwootChat` without a `ChatwootUser` or a `ChatwootUser` without an email is currently impossible, despite `user` being nullable.

```
======== Exception caught by Flutter framework =====================================================
The following _CastError was thrown:
type 'Null' is not a subtype of type 'String' in type cast

When the exception was thrown, this was the stack:
#0 _$ChatwootContactFromJson (package:chatwoot_sdk/data/local/entity/chatwoot_contact.g.dart:65:26)
#1 new ChatwootContact.fromJson (package:chatwoot_sdk/data/local/entity/chatwoot_contact.dart:46:7)
#2 ChatwootClientAuthServiceImpl.createNewContact (package:chatwoot_sdk/data/remote/service/chatwoot_client_auth_service.dart:40:41)

#3 ChatwootClientApiInterceptor.onRequest. (package:chatwoot_sdk/data/remote/service/chatwoot_client_api_interceptor.dart:37:19)

#4 BasicLock.synchronized (package:synchronized/src/basic_lock.dart:33:16)

#5 ChatwootClientApiInterceptor.onRequest (package:chatwoot_sdk/data/remote/service/chatwoot_client_api_interceptor.dart:29:5)

I/flutter (18358): #5 ChatwootClientApiInterceptor.onRequest (package:chatwoot_sdk/data/remote/service/chatwoot_client_api_interceptor.dart:29:5)
====================================================================================================

======== Exception caught by Flutter framework =====================================================
The following _CastError was thrown:
type 'Null' is not a subtype of type 'String' in type cast

When the exception was thrown, this was the stack:
#0 _$ChatwootContactFromJson (package:chatwoot_sdk/data/local/entity/chatwoot_contact.g.dart:65:26)
#1 new ChatwootContact.fromJson (package:chatwoot_sdk/data/local/entity/chatwoot_contact.dart:46:7)
#2 ChatwootClientAuthServiceImpl.createNewContact (package:chatwoot_sdk/data/remote/service/chatwoot_client_auth_service.dart:40:41)

#3 ChatwootClientApiInterceptor.onRequest. (package:chatwoot_sdk/data/remote/service/chatwoot_client_api_interceptor.dart:37:19)

#4 BasicLock.synchronized (package:synchronized/src/basic_lock.dart:33:16)

#5 ChatwootClientApiInterceptor.onRequest (package:chatwoot_sdk/data/remote/service/chatwoot_client_api_interceptor.dart:29:5)

====================================================================================================

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with data/local/entity/chatwoot_contact.dart and its generated chatwoot_contact.g.dart file, then follow createNewContact in data/remote/service/chatwoot_client_auth_service.dart. Reproduce the request without a ChatwootUser and without an email, and consider the issue done when neither case raises the reported null-to-String cast error.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.