Code Monkey home page Code Monkey logo

getstream / stream-chat-flutter Goto Github PK

View Code? Open in Web Editor NEW
858.0 19.0 303.0 79.59 MB

Flutter Chat SDK - Build your own chat app experience using Dart, Flutter and the Stream Chat Messaging API.

Home Page: https://getstream.io/chat/sdk/flutter/

License: Other

Kotlin 0.03% Swift 0.07% Objective-C 0.01% Dart 78.40% Java 0.01% HTML 0.21% JavaScript 0.02% CMake 0.90% C++ 1.39% C 0.08% MDX 18.88% Shell 0.02%
stream-chat chat chat-sdk messaging flutter sdk widgets flutter-plugin flutter-chat dart

stream-chat-flutter's Introduction

Official Flutter packages for Stream Chat

CI Melos

Quick Links

This repository contains code for our Dart and Flutter chat clients.

Stream allows developers to rapidly deploy scalable feeds and chat messaging with an industry leading 99.999% uptime SLA guarantee.

V4 Migration Guide

Warning

Flutter > = v3.16.x uses material 3 by default which breaks the UI of some of the components. If you want to use these versions, you need to set the useMaterial3 parameter to false in the ThemeData.

eg.

MaterialApp(
  theme: ThemeData(
    useMaterial3: false,
  ),
  ...
);

StreamChat widget overrides the useMaterial3 parameter to false by default so if you are using StreamChat widget, you don't need to set it manually.

For upgrading from V6 to V7, please refer to the V4 Migration Guide

Sample apps and demos

Our team maintains a dedicated repository for full fledged sample applications and demos. Consider checking out GetStream/flutter-samples to learn more or get started by looking at our latest Stream Chat demo.

Free for Makers

Stream is free for most side and hobby projects. To qualify your project/company needs to have < 5 team members and < $10k in monthly revenue. For complete pricing details visit our Chat Pricing Page

Structure

Stream Chat Dart is a monorepo built using Melos. Individual packages can be found in the packages directory while configuration and top level commands can be found in melos.yaml.

To get started, run bootstrap after cloning the project.

melos bootstrap

Packages

We provide a variety of packages depending on the level of customization you want to achieve.

A pure Dart package that can be used on any Dart project. It provides a low-level client to access the Stream Chat service.

This package provides a persistence client for fetching and saving chat data locally. Stream Chat Persistence uses Moor as a disk cache.

This package provides business logic to fetch common things required for integrating Stream Chat into your application. The core package allows more customisation and hence provides business logic but no UI components.

This library includes both a low-level chat SDK and a set of reusable and customizable UI components.

This library includes a set of localization files for the Flutter UI components.

Flutter Chat Tutorial

The best place to start is the Flutter Chat Tutorial. It teaches you how to use this SDK and also shows how to make frequently required changes.

Example Apps

Every package folder includes a fully functional example with setup instructions.

We also provide a set of sample apps created using the Stream Flutter SDK at this location.

Versioning Policy

All of the Stream Chat packages follow semantic versioning.

See our versioning policy documentation for more information.

We are hiring

We've recently closed a $38 million Series B funding round and we keep actively growing. Our APIs are used by more than a billion end-users, and you'll have a chance to make a huge impact on the product within a team of the strongest engineers all over the world.

Check out our current openings and apply via Stream's website.

stream-chat-flutter's People

Contributors

adasiewiczr avatar ayush221b avatar brazol avatar bstolinski avatar ccebrecos avatar chriselliotuk avatar dependabot[bot] avatar deven98 avatar dkrutskikh avatar esarbanis avatar felangel avatar geweald avatar groovinchip avatar hayesgordon avatar imtoori avatar incendial avatar jcminarro avatar jeroenleenarts avatar juanleondev avatar leandroborgesferreira avatar mateushbr avatar nash0x7e2 avatar nosmirck avatar rlee1990 avatar s-ecki avatar sachaarbonel avatar santiagogarcia97 avatar tbarbugli avatar tombeckett avatar xsahil03x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stream-chat-flutter's Issues

Querying channels using channel name

Basically i want to do something like search box on the top of my ChannelListView.
I know that we can filter using members but currently it only allows filter using user.id not user name or channel name

Force close on iOS

I got an error like this after i add dependency stream_chat_flutter: ^0.1.11
when i try to run it on iOS, my app suddenly got force close

*** First throw call stack: ( 0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350 1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48 2 CoreFoundation 0x00007fff23c70ff8 +[NSException raise:format:arguments:] + 88 3 Foundation 0x00007fff256e9b51 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191 4 Flutter 0x000000010249ae32 -[FlutterEngine registrarForPlugin:] + 282 5 Runner 0x000000010173bdd0 +[GeneratedPluginRegistrant registerWithRegistry:] + 1040 6 Runner 0x000000010173c2e0 $s6Runner11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtF + 176 7 Runner <â€Ļ>

ChannelHeader needs an 'onTap' method

Channel Header provides a way to customize the display and action of the back button but nothing to do an action for when the header is tapped.

Propposed solution:

  • Add an action (similar to the onBackPressed) for when the ChannelName Widget is tapped.

This is useful for showing a custom page with the channel information (image, members, custom actions for notifications, adding more people to the chat, etc)

On the same note, a custom action on tapping the channel's image ChannelImage can be added.

Bad state: Cannot add new events after calling close

i got this error message when using the alpha version

E/flutter (31659): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Bad state: Cannot add new events after calling close
E/flutter (31659): #0      _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:251:24)
E/flutter (31659): #1      Subject._add (package:rxdart/src/subjects/subject.dart:141:17)
E/flutter (31659): #2      Subject.add (package:rxdart/src/subjects/subject.dart:135:5)
E/flutter (31659): #3      ChannelsBlocState.queryChannels.<anonymous closure> (package:stream_chat_flutter/src/channels_bloc.dart:90:31)
E/flutter (31659): #4      _rootRunUnary (dart:async/zone.dart:1192:38)
E/flutter (31659): #5      _CustomZone.runUnary (dart:async/zone.dart:1085:19)
E/flutter (31659): #6      _CustomZone.runUnaryGuarded (dart:async/zone.dart:987:7)
E/flutter (31659): #7      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
E/flutter (31659): #8      _DelayedData.perform (dart:async/stream_impl.dart:594:14)
E/flutter (31659): #9      _StreamImplEvents.handleNext (dart:async/stream_impl.dart:710:11)
E/flutter (31659): #10     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:670:7)
E/flutter (31659): #11     _rootRun (dart:async/zone.dart:1180:38)
E/flutter (31659): #12     _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter (31659): #13     _CustomZone.runGuarded (dart:async/zone.dart:979:7)
E/flutter (31659): #14     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1019:23)
E/flutter (31659): #15     _rootRun (dart:async/zone.dart:1184:13)
E/flutter (31659): #16     _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter (31659): #17     _CustomZone.runGuarded (dart:async/zone.dart:979:7)
E/flutter (31659): #18     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1019:23)
E/flutter (31659): #19     _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
E/flutter (31659): #20     _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)

the chat functionality still working fine though

Customize ChannelHeader & MessageInput

is there a way to customize ChannelHeader & MessageInput ?
for example change the logic to upload attachment to my own CDN, or use my own AppBar as ChannelHeader

ChannelListView NULL error when a channel has no messages

When creating a new channel (for example, from the CLI), that does not have any messages in the channel, will cause ChannelListView widget to throw an error as there are no checks to see if the channel message list is empty.

The method 'toLocal' was called on null.
Receiver: null
Tried calling: toLocal()

The relevant error-causing widget was
    ChannelListView 
lib/main.dart:147
When the exception was thrown, this was the stack
#0      Object.noSuchMethod  (dart:core-patch/object_patch.dart:53:5)
#1      ChannelPreview._buildDate.<anonymous closure> 
package:stream_chat_flutter/src/channel_preview.dart:71
#2      StreamBuilder.build 
package:flutter/â€Ļ/widgets/async.dart:425
#3      _StreamBuilderBaseState.build 
package:flutter/â€Ļ/widgets/async.dart:125
#4      StatefulElement.build 
package:flutter/â€Ļ/widgets/framework.dart:4334
... 

There needs to some validation to make sure there are messages, before calling:

final lastMessageAt = snapshot.data.toLocal(); in "channel_preview.dart"

Widget _buildDate(BuildContext context) {
    return StreamBuilder<DateTime>(
      stream: channel.lastMessageAtStream,
      initialData: channel.lastMessageAt,
      builder: (context, snapshot) {
        final lastMessageAt = snapshot.data.toLocal();

        String stringDate;
        final now = DateTime.now();

        if (now.year != lastMessageAt.year ||
            now.month != lastMessageAt.month ||
            now.day != lastMessageAt.day) {
          stringDate = Jiffy(lastMessageAt.toLocal()).format('dd/MM/yyyy');
        } else {
          stringDate = Jiffy(lastMessageAt.toLocal()).format('HH:mm');
        }

        return Text(
          stringDate,
          style: StreamChatTheme.of(context).channelPreviewTheme.lastMessageAt,
        );
      },
    );
  }

[Notification] Error during resync

i got this error message after implementing notification for my ios app, but the notification and chat functionality is working fine though

flutter: (2020-06-18 13:54:58.181137) 🚨 📡 Error during resync ApiError{body: Not Found, jsonData: null, status: 404, code: null}

Incoming messages are not coming after a re-connection due to network change or connection reset

I am testing your Flutter Chat SDK "0.2.1-alpha+3" with offline capability which is critical for our use case. Reported a problem via GitHub page 2 days back and thanks for fixing the database exception quickly.

After trying the latest Alpha build one problem I have observed is incoming messages are not coming after a re-connection due to network change or connection reset, though outgoing messages are going after re-connection. If user manually refreshes the chats landing page by pull refresh, messages are being pulled from server by calling an API but until that is done manually messages are noting getting delivered to the client. What can we do to ensure message sent receive happens automatically as soon as server connection is established.

Also please let us know if we should report this kind of issues via support or should we post it on GitHub page, we will follow as you advise.

Steps to reproduce issue:

  1. Login in app
  2. Send messages
  3. Turn off internet connectivity
  4. Sent some messages from other device
  5. Again turn on internet connectivity
    Then that message is not received until we manually refresh the lending page or re-open app.

Ability to render Custom Attachment Type

The api provides a way to send a custom payload through attachments and we can have a MessageBuilder that easily handles this scenario:

MessageListView(
  showVideoFullScreen: true,
  messageBuilder:_buildCustomMessage,
  showOtherMessageUsername: true,
  threadBuilder: (_, parentMessage) {
  return ThreadPage(
  parent: parentMessage,
  );
  },
),

and in _buildCustom Message logic for it can be done, however, it would basically requiere to re-write the MessageWidget with all its features + a small set of builders for the attachments.

Proposed Solution:

Add a list of AttachmentBuilders to the MessageListView that can be passed down to the MessageWidget and it can be used during _buildBubble

WARNING (moor): It looks like you've created the database classOfflineStorage multiple times.

i got this warning message after disconnect from current client using client.disconnect(); and then set a new user using _client.setUser()

error warning
I/flutter (12293): WARNING (moor): It looks like you've created the database classOfflineStorage multiple times. When these two databases use the same QueryExecutor, race conditions will ocur and might corrupt the database. 
I/flutter (12293): Try to follow the advice at https://moor.simonbinder.eu/faq/#using-the-database or, if you know what you're doing, set moorRuntimeOptions.dontWarnAboutMultipleDatabases = true
I/flutter (12293): Here is the stacktrace from when the database was opened a second time:
I/flutter (12293): #0      GeneratedDatabase._handleInstantiated (package:moor/src/runtime/api/db_base.dart:90:30)
I/flutter (12293): #1      new GeneratedDatabase.connect (package:moor/src/runtime/api/db_base.dart:69:12)
I/flutter (12293): #2      new _$OfflineStorage.connect (package:stream_chat/src/db/offline_storage.g.dart:3761:58)
I/flutter (12293): #3      new OfflineStorage.connect (package:stream_chat/src/db/offline_storage.dart:101:13)
I/flutter (12293): #4      connectDatabase (package:stream_chat/src/db/offline_storage.dart:58:25)
I/flutter (12293): <asynchronous suspension>
I/flutter (12293): #5      Client.connect (package:stream_chat/src/client.dart:408:31)
I/flutter (12293): #6      Client.setUser
E/flutter (12293): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: NoSuchMethodError: The method 'where' was called on null.
E/flutter (12293): Receiver: null
E/flutter (12293): Tried calling: where(Closure: (SortOption) => bool)
E/flutter (12293): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
E/flutter (12293): #1      OfflineStorage.getChannelStates.<anonymous closure> (package:stream_chat/src/db/offline_storage.dart:242:12)
E/flutter (12293): #2      _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (12293): #3      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (12293): #4      _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
E/flutter (12293): #5      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
E/flutter (12293): #6      Future._propagateToListeners (dart:async/future_impl.dart:725:32)
E/flutter (12293): #7      Future._completeWithValue (dart:async/future_impl.dart:529:5)
E/flutter (12293): #8      _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
E/flutter (12293): #9      _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
E/flutter (12293): #10     SimpleSelectStatement._getWithQuery (package:moor/src/runtime/query_builder/statements/select/select.dart)
E/flutter (12293): <asynchronous suspension>
E/flutter (12293): #11     SimpleSelectStatement.get (package:moor/src/runtime/query_builder/statements/select/select.dart:35:12)
E/flutter (12293): #12     OfflineStorage.getChannelStates (package:stream_chat/src/db/offline_storage.dart:236:10)
E/flutter (12293): #13     Client.queryChannels (package:stream_chat/src/client.dart:561:52)
E/flutter (12293): <asynchronous suspension>
E/flutter (12293): #14     Client.connect.<anonymous closure> (package:stream_chat/src/client.dart:437:9)
E/flutter (12293): #15     Client.connect.<anonymous closure> (package:stream_chat/src/client.dart:427:33)
E/flutter (12293): #16     ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:209:21)
E/flutter (12293): #17     ValueNotifier.value= (package:flutter/src/foundation/change_notifier.dart:276:5)
E/flutter (12293): #18     WebSocket._onData (package:stream_chat/src/api/websocket.dart:167:24)
E/flutter (12293): #19     WebSocket.connect.<anonymous closure> (package:stream_chat/src/api/websocket.dart:132:9)
E/flutter (12293): #20     _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (12293): #21     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (12293): #22     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (12293): #23     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
E/flutter (12293): #24     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
E/flutter (12293): #25     _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:127:11)
E/flutter (12293): #26     _HandleErrorStream._handleData (dart:async/stream_pipe.dart:266:10)
E/flutter (12293): #27     _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:157:13)
E/flutter (12293): #28     _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (12293): #29     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (12293): #30     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (12293): #31     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
E/flutter (12293): #32     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
E/flutter (12293): #33     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:811:19)
E/flutter (12293): #34     _StreamController._add (dart:async/stream_controller.dart:682:7)
E/flutter (12293): #35     _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (12293): #36     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (12293): #37     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (12293): #38     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
E/flutter (12293): #39     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
E/flutter (12293): #40     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:811:19)
E/flutter (12293): #41     _StreamController._add (dart:async/stream_controller.dart:682:7)
E/flutter (12293): #42     _StreamController.add (dart:async/stream_controller.dart:624:5)
E/flutter (12293): #43     new _WebSocketImpl._fromSocket.<anonymous closure> (dart:_http/websocket_impl.dart:1145:21)
E/flutter (12293): #44     _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (12293): #45     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (12293): #46     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (12293): #47     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
E/flutter (12293): #48     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
E/flutter (12293): #49     
E/flutter (12293): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: Bad state: Cannot add new events after calling close
E/flutter (12293): #0      _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:249:24)
E/flutter (12293): #1      Subject._add (package:rxdart/src/subjects/subject.dart:141:17)
E/flutter (12293): #2      Subject.add (package:rxdart/src/subjects/subject.dart:135:5)
E/flutter (12293): #3      _StreamSinkWrapper.add (package:rxdart/src/subjects/subject.dart:167:13)
E/flutter (12293): #4      ChannelsBlocState.queryChannels (package:stream_chat_flutter/src/channels_bloc.dart:72:42)
E/flutter (12293): #5      _ChannelListState.initState.<anonymous closure> (package:homy_mobile/screens/home/tabs/chat_list/components/channel_list.dart:415:20)
E/flutter (12293): #6      _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (12293): #7      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (12293): #8      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (12293): #9      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
E/flutter (12293): #10     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
E/flutter (12293): #11     _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:127:11)
E/flutter (12293): #12     _WhereStream._handleData (dart:async/stream_pipe.dart:199:12)
E/flutter (12293): #13     _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:157:13)
E/flutter (12293): #14     _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (12293): #15     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (12293): #16     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (12293): #17     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
E/flutter (12293): #18     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
E/flutter (12293): #19     _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:385:25)
E/flutter (12293): #20     _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:250:5)
E/flutter (12293): #21     _StartWithStreamSink.add (package:rxdart/src/transformers/start_with.dart:16:10)
E/flutter (12293): #22     forwardStream.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:rxdart/src/utils/forwarding_stream.dart:34:49)
E/flutter (12293): #23     forwardStream.runCatching (package:rxdart/src/utils/forwarding_stream.dart:24:12)
E/flutter (12293): #24     forwardStream.<anonymous closure>.<anonymous closure> (package:rxdart/src/utils/forwarding_stream.dart:34:28)
E/flutter (12293): #25     _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter (12293): #26     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter (12293): #27     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter (12293): #28     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
E/flutter (12293): #29     _DelayedData.perform (dart:async/stream_impl.dart:611:14)
E/flutter (12293): #30     _StreamImplEvents.handleNext (dart:async/stream_impl.dart:730:11)
E/flutter (12293): #31     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:687:7)
E/flutter (12293): #32     _rootRun (dart:async/zone.dart:1182:47)
E/flutter (12293): #33     _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter (12293): #34     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter (12293): #35     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
E/flutter (12293): #36     _rootRun (dart:async/zone.dart:1190:13)
E/flutter (12293): #37     _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter (12293): #38     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter (12293): #39     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
E/flutter (12293): #40     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter (12293): #41     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
E/flutter (12293): 

i dont know if i should be concerned or it just a false warning message

Side by side support for channel list and message list

What would be the best approach to have a side by side chat experience? I'm developing an app that supports tablet screen width. Looks like route navigation is already built-in so clicking on a channel would just push open the provided channelWidget?

Videos show wide stretched

Videos, whether uploaded or taken, show as stretched horizontally. See attached photos:

  1. Screenshot from the original video taken on the iPhone 11 Max
    IMG_3840

  2. How it looks in chat when played fullscreen
    IMG_3839

  3. How it looks in chat inline
    IMG_3841

Online presence and Last Seen issue

We are testing the Alpha+4 build and enabled Presence and Last Seen in the application. Before doing that we figured out how to check information from server by logging and quering it at API level.

What we observed is a inconsistent behavior from client on updating the status to server.

Even if we kill the application of user A it keeps showing online on user B, and this goes on even if we restart application of User B it keeps showing user A as online. Secondly if User A is showing "5 mins back" to User B and we stop application on user B and then start application on user A send a message and stop it, it should show "few seconds or 1 min" back on user B but it shows "6 mins" back which means user A did not update the information to server correctly, to reverify it we checked on server and it was not updated. Same behavior if we interchange User A and User B or user C and user D, etc, so it is reproducible.

But at the same it is not happening every time, sometimes it is updating the information on server and we are able to see correctly.
Also we have checked with API response, user last active not showing correctly sometimes.

MessageInput grows indefinitely

Message Input grows with message content but doesn't stop, reaching an overflow.

Image attached for reference:

Simulator Screen Shot - iPhone 11 Pro Max - 2020-04-06 at 11 47 25

If there's no one working on this one, I can PR a fix today.

Building for Web

When building via flutter run -d chrome --verbose web I get the following:

[        ] ../../../../.pub-cache/hosted/pub.dartlang.org/moor_ffi-0.5.0/lib/src/bindings/types.dart:6:8: Error: Not found: 'dart:ffi'
[        ] import 'dart:ffi';
[        ]        ^
[   +3 ms] ../../../../.pub-cache/hosted/pub.dartlang.org/moor_ffi-0.5.0/lib/src/impl/database.dart:2:8: Error: Not found: 'dart:ffi'
[        ] import 'dart:ffi';
[        ]        ^
[        ] ../../../../.pub-cache/hosted/pub.dartlang.org/moor_ffi-0.5.0/lib/src/ffi/blob.dart:2:8: Error: Not found: 'dart:ffi'
[        ] import 'dart:ffi';
[        ]        ^
[        ] ../../../../.pub-cache/hosted/pub.dartlang.org/moor_ffi-0.5.0/lib/src/ffi/utils.dart:1:8: Error: Not found: 'dart:ffi'
[        ] import 'dart:ffi';
[        ]        ^
[        ] ../../../../.pub-cache/hosted/pub.dartlang.org/moor_ffi-0.5.0/lib/src/bindings/bindings.dart:5:8: Error: Not found: 'dart:ffi'
[        ] import 'dart:ffi';
[        ]        ^
[   +1 ms] ../../../../.pub-cache/hosted/pub.dartlang.org/moor_ffi-0.5.0/lib/src/bindings/signatures.dart:5:8: Error: Not found: 'dart:ffi'
[        ] import 'dart:ffi';
[        ]        ^
[  +64 ms] ../../../../.pub-cache/hosted/pub.dartlang.org/moor_ffi-0.5.0/lib/open_helper.dart:5:8: Error: Not found: 'dart:ffi'
[        ] import 'dart:ffi';
...

I've tried various things from this repository to try and get it working with no success https://github.com/rodydavis/moor_shared

Could you please provide a sample web target for this project to get started with this on Web?

gz#4510

Read & Delivered indicator

I think we need to add read & delivered indicator for one-to-one conversations, currently it only shows SendingIndicator

No way to hide keyboard

Once you tap the text input field, the keyboard cannot be hidden without sending a message. This is a problem if you have bottom bar navigation and have showBackButton: false.

How to change background color of streamchat widget.

Hey!! I want to change the bg color of my StreamChat widget but even after changing the streamChatThemeData nothing works.

This is what my code looks like

Chat.StreamChat(
                  client: controller.client,
                  streamChatThemeData: Chat.StreamChatThemeData.fromTheme(appTheme),
                  child: Chat.StreamChannel(
                    channel: controller.channel,
                    child: ChannelPage(),
                  ),
                ),

How can i open ChannelPage out of ChannelListPage

I have followed the guide create the ChannelListPage and ChannelPage, and it works fine for me. But now I want to open a one to one conversation, but when I navigate to StreamChannel, it keeps on loading, and I don't know how to make it work. Help me, please.

This is my code.

class ChannelListPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: Text(
          'Messages',
          style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
        ),
      ),
      bottomNavigationBar: CustomButtomBar(
        index: 2,
      ),
      body: ChannelsBloc(
        child: ChannelListView(
          filter: {
            'members': {
              '\$in': [StreamChat.of(context).user.id],
            }
          },
          sort: [SortOption('last_message_at')],
          pagination: PaginationParams(
            limit: 20,
          ),
          channelWidget: ChannelPage(),
        ),
      ),
    );
  }
}

class ChannelPage extends StatelessWidget {
  const ChannelPage({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: ChannelHeader(),
      body: Column(
        children: <Widget>[
          Expanded(
            child: MessageListView(
              threadBuilder: (_, parentMessage) {
                return ThreadPage(
                  parent: parentMessage,
                );
              },
            ),
          ),
          MessageInput(),
        ],
      ),
    );
  }
}

class ThreadPage extends StatelessWidget {
  final Message parent;

  ThreadPage({
    Key key,
    this.parent,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: ThreadHeader(
        parent: parent,
      ),
      body: Column(
        children: <Widget>[
          Expanded(
            child: MessageListView(
              parentMessage: parent,
            ),
          ),
          MessageInput(
            parentMessage: parent,
          ),
        ],
      ),
    );
  }
}

and these is how to navigate to channel page. These code is in other place to jump to ChannelPage.

                                onTap: () async {
                                  var conversation = Chat()
                                      .client
                                      .channel("messaging", extraData: {
                                    "members": [
                                      user.id.toString(),
                                      ClientChannelManager.getUser()
                                          .id
                                          .toString()
                                    ]
                                  });
                                  Navigator.push(context, MaterialPageRoute(
                                    builder: (context) {
                                      return StreamChannel(
                                        child: ChannelPage(),
                                        channel: conversation,
                                      );
                                      //   return MessagePage(
                                      //   userId: user.id,
                                      // );
                                    },
                                  ));
                                },

and the app keep in this state
photo_2020-07-27_01-33-24

gz#4631

Release mode getting issue

Hey team,
We have checkout your tags and testing with release mode and debug mode with 0.2.1_alpha+6, 0.2.1_alpha+4, 0.2.1_alpha+3 and run with release mode but in all these branch getting issue on release mode.

Issue (log):
I/flutter (23069): (2020-05-30 11:47:47.952083) ℹī¸ RETRY QUEUE messaging:!members-CMejYZeK0zXGsUZ88VX0boqoicKpoQhWYJvGRRFNCpE add 0 messages E/flutter (23069): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: "SqliteException(275): CHECK constraint failed: users, constraint failed (code 275)" E/flutter (23069): #0 PreparedStatement.execute (package:moor_ffi/src/impl/prepared_statement.dart:96) E/flutter (23069): #1 _VmDelegate.runBatched (package:moor_ffi/src/vm_database.dart:54) E/flutter (23069): #2 _ExecutorWithQueryDelegate.runBatched.<anonymous closure> (package:moor/src/runtime/executor/helpers/engines.dart:90) E/flutter (23069): #3 BasicLock.synchronized (package:synchronized/src/basic_lock.dart:32) E/flutter (23069): #4 _ExecutorWithQueryDelegate._synchronized (package:moor/src/runtime/executor/helpers/engines.dart:22) E/flutter (23069): #5 _ExecutorWithQueryDelegate.runBatched (package:moor/src/runtime/executor/helpers/engines.dart:86) E/flutter (23069): #6 _MoorServer._runBatched (package:moor/src/runtime/isolate/server.dart:97) E/flutter (23069): <asynchronous suspension> E/flutter (23069): #7 IsolateCommunication.setRequestHandler.<anonymous closure>.<anonymous closure> (package:moor/src/runtime/isolate/communication.dart:167) E/flutter (23069): <asynchronous suspension>

Ability to send Custom Attachments

We would like the ability to send custom attachment with custom payload

Example:

For the MessageInput Widget we would need to add customAttachmentActions which is a List of AttachmentActions that would appear alongside the normal attachment button (or maybe provide extra options to customize where it goes, either within the same attachments options or separate with a custom icon, right side, below/above the input box, etc)

{
  type: 'myinfo',
  payload: 
  {
    email: '[email protected]',
    phoneNumber: '555-1234567'
    address: '123 My Avenue East, My City, AA, My Country, P0ST4L'
  }
}

or something like the following attachment:

{
  type: 'mytodo',
  payload:
  {
    title: 'groceries'
    items:
    [
      {
        name: 'pasta',
        completed: 'false'
      },
      {
        name: 'tomatoes',
        completed: 'true'
      }
    ]
}

Note: the actual custom object for attachment can be configured as you guys think is best, this is just an example, I used payload to describe the custom object I'm sending/receiving in my chat.

The idea here is that we can build custom messaging apps, for instance, a chat for groceries apps where you can keep your "to do" list of groceries and send it to your friend and renders a preview in the messages window.

When chatting continuously then message not receiving after some time, Getting exceptions.

I am using version: 0.2.1-alpha+1.
I am facing some issues.

When we are chatting with each other then after some time message not received and getting exception like this.
Getting error:

  1. Message is received but not display the error is like database:
    E/flutter ( 5438): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: "SqliteException(5): database is locked, database is locked (code 5)"
    E/flutter ( 5438): #0 PreparedStatement.execute (package:moor_ffi/src/impl/prepared_statement.dart:96:7)
    E/flutter ( 5438): #1 _VmDelegate._runWithArgs (package:moor_ffi/src/vm_database.dart:72:12)
    E/flutter ( 5438): #2 _VmDelegate.runInsert (package:moor_ffi/src/vm_database.dart:84:11)
    E/flutter ( 5438): #3 _ExecutorWithQueryDelegate.runInsert. (package:moor/src/runtime/executor/helpers/engines.dart:69:19)
    E/flutter ( 5438): #4 BasicLock.synchronized (package:synchronized/src/basic_lock.dart:32:26)
    E/flutter ( 5438): #5 _ExecutorWithQueryDelegate._synchronized (package:moor/src/runtime/executor/helpers/engines.dart:22:26)
    E/flutter ( 5438): #6 _ExecutorWithQueryDelegate.runInsert (package:moor/src/runtime/executor/helpers/engines.dart:67:12)
    E/flutter ( 5438): #7 LazyDatabase.runInsert (package:moor/src/utils/lazy_database.dart:60:17)
    E/flutter ( 5438): #8 _MoorServer._runQuery (package:moor/src/runtime/isolate/server.dart:87:25)
    E/flutter ( 5438):
    E/flutter ( 5438): #9 _MoorServer._handleRequest (package:moor/src/runtime/isolate/server.dart:57:14)
    E/flutter ( 5438): #10 IsolateCommunication.setRequestHandler. (package:moor/src/runtime/isolate/communication.dart:163:31)
    E/flutter ( 5438): #11 _RootZone.runUnaryGuarded (dart:async/zone.dart:1316:10)
    E/flutter ( 5438): #12 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:338:11)
    E/flutter ( 5438): #13 _DelayedData.perform (dart:async/stream_impl.dart:593:14)
    E/flutter ( 5438): #14 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:709:11)
    E/flutter ( 5438): #15 _PendingEvents.schedule. (dart:async/stream_impl.dart:669:7)
    E/flutter ( 5438): #16 _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
    E/flutter ( 5438): #17 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
    E/flutter ( 5438): #18 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
    E/flutter ( 5438): #19 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:175:5)

  2. If we satay on screen then after some time getting error like this.
    The getter 'values' was called on null.
    Receiver: null
    Tried calling: values

When the exception was thrown, this was the stack:
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
#1 _MessageWidgetState._updateReactionPadding. (package:stream_chat_flutter/src/message_widget.dart:336:41)
#2 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1113:15)
#3 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1060:9)
#4 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:968:5)

Support for Stream<List<User>>

Just like we have a stream for list of channels: Stream<List<Channel>> Will it be possible to have a stream of users like this: Stream<List<User>>. So, we can always have an updated list of users.

addMembers

Hi,

I'm currently trying to figure out how to add members to a channel.

This is the call I'm making but it seems to be resulting in a Dio related error (unable to encode an object)

I'm not really sure if I'm calling the function incorrectly or if this is a problem with Stream Chat. I'd really appreciate any guidance!

Please let me know if you need to see more of my code.

image

image

Also it seems the Dart docs are outdated, the way addMembers is called here seems incorrect.

image

gz#5163

The getter 'MediaType' isn't defined for the class '_MessageInputState'

Every time I try to run a project with stream_chat_flutter: ^0.1.23 I get this error when building on iOS.

../../../.pub-cache/hosted/pub.dartlang.org/stream_chat_flutter-0.1.23/lib/src/message_input.dart:655:24: Error: The getter 'MediaType' isn't defined for the class '_MessageInputState'.
 - '_MessageInputState' is from 'package:stream_chat_flutter/src/message_input.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/stream_chat_flutter-0.1.23/lib/src/message_input.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'MediaType'.
          contentType: MediaType.parse(lookupMimeType(filename)),
                       ^^^^^^^^^

Hope add support for voice chatting and video chatting

We have embedded this chat SDK, and now we need to add voice chatting and video chatting, I had read the document, but Voxeet doesn't have a flutter SDK yet. is there any plan of voice chatting and video chatting? Thanks.

gz#5219

Add capabilities dependencies to the readme

This app introduces at least a few capabilities that need to be added to info.plist and other places on iOS.

  • Apple notification service
  • Photo library
  • Contacts?
  • Location?
  • Speech Recognition?
  • Calendars?

I'm not sure what's generating all these requirements in my app. The top two at least are clearly from this package. Could all of the necessary capabilities be listed?

App crashes when trying to hit send before video finishes processing

Steps to recreate:

  • tap + and "video from camera"
  • record a video
  • select "use video"
  • while the video still has the "loading" gif on top of it, hit send

App crashes. I assume this would also happen for photos if your internet was slow.

Thanks for this integration, as I've said it's the reason we're using Stream. Excited to see how it evolves.

StreamChat is overriding onGenerateRoute when navigating using named route

Expected results:

When using Navigator.pushNamed it goes to my own onGenerateRoute from my main.dart

Actual results:

instead it goes to onGenerateRoute inside stream_chat.dart:

child: Navigator(
  initialRoute: '/',
  key: _navigatorKey,
  onGenerateRoute: (settings) {
    return MaterialPageRoute(
      settings: settings,
      builder: (_) => widget.child,
    );
  },
),

Dark Theme

Dark Theme seems to be not properly implemented, despite the advertised images on the website.

Using the system theme mode dark (after setting the themes correctly) like this:

Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.light(),
      darkTheme: ThemeData.dark(),
      themeMode: ThemeMode.system,
      home: Container(
        child: StreamChat(
          client: client,
          child: ChannelListPage(),
        ),
      ),
    );
  }

causes this:

Simulator Screen Shot - iPhone 11 Pro Max - 2020-04-06 at 11 50 36

As seen in the image, nothing is dark themed, plus, the message box has white text over white background.
If there's no one working on this, I can fix it and PR, please let me know.

Block channel

is there a way to block a channel so that all of the channel members no longer be able chat on that channel, and the blocked channel did not appear on channel list?

Keyboard opens on top of camera view

To recreate:

  • tap in the text area of the message send box so that the keyboard comes up
  • with the keyboard still up, tap the + button for an attachment
  • select "photo from camera" or "video from camera"

The keyboard will come up over the camera view. There's no way to escape this without force quitting the app.

Maybe the + button needs to unfocus the text field?

StreamChat dispose() tears down the Client connection

Hello, my team is evaluating Stream and I am very happy with the Flutter and React UI Kits so far. The flutter kit particularly was the big differentiator for us. Kudos!

One problem I was having was that tabbing away from the chat window using BottomNavigationBar tabs caused the Client object to get torn down and the connection to get disconnected, so that when I navigate back to it again I get errors that it has been disconnected.

This is despite the fact that my Client is initialized before runApp .

Root Cause

I found that StreamChat.dispose() calls widget.client.dispose(). This effectively ties the lifecycle of the Client object to the lifecycle of a widget that uses it. From a memory perspective this is not saving anything; in the Stream documentation it is recommended that the Client be created at the top and persist through the lifecycle of the entire app, so it doesn't make sense to dispose of that top level Client object when disposing of a widget that makes use of it.

Workaround

If anyone is experiencing a similar issue, I worked around it by extending the Client class and overriding the dispose method to do nothing:

import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'package:dio/dio.dart';

class CustomClient extends Client {
  // Get this from the actual Client source code
  static const _defaultBaseURL = "chat-us-east-1.stream-io-api.com";

  CustomClient(
    apiKey, {
    tokenProvider,
    baseURL = _defaultBaseURL,
    logLevel = Level.WARNING,
    logHandlerFunction,
    Duration connectTimeout = const Duration(seconds: 6),
    Duration receiveTimeout = const Duration(seconds: 6),
    Dio httpClient,
  }) : super(apiKey,
            tokenProvider: tokenProvider,
            baseURL: baseURL,
            logLevel: logLevel,
            logHandlerFunction: logHandlerFunction,
            connectTimeout: connectTimeout,
            receiveTimeout: receiveTimeout,
            httpClient: httpClient);

  @override
  void dispose() {
    // Don't do anything so the connection doesn't get torn down
  }
}

Then, simply use this class rather than Client at the top of your app:

final client = CustomClient(
    'XXX',
    logLevel: Level.INFO,
  );

After this, the StreamChat widget will get torn down and restored as you tab back and forth, but the Client will survive it.

App freezes after taking a photo

I have not found this to be re-creatable 100% of the time on all devices. One of our iPhones it's hit or miss, another one it happens every time without fail.

Steps to recreate:

  • press the + button for attachment
  • press "photo from camera"
  • take a photo

App is frozen. Force restart needed.

iPhone 11 Max is the one that always freezes. iPhone 7 Plus intermittent.

one to one channel example

is there an example about how to initiate one to one conversation?

i got error like this when i call await channel.watch();

E/flutter (19258): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: ApiError{body: Not Found, jsonData: null, status: 404, code: null}

Missing "teams" field for a user

We're blocked by the fact that the teams field is missing from a user. Other SDKs have this, and we're working on a multi-tenant/team feature, and we cannot make queries providing the team info of a user.

gz#5458

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.