The Simple chat app demonstrates how to build a chat application using PubNub Chat and PubNub Dart SDK. Learn how to add private messaging and group messaging features in general chat application. Learn how to build features like send/receive messages, typing indicators, online members list. You can download the project to run on your local machine, and explore the code to see how we built it.
The application uses PubNub service with Dart SDK.
- Flutter
- PubNub Account (Free)
To run this application you must obtain publish and subscribe keys from your PubNub Account. If you don't already have an account, you can create one for free.
-
Sign in to your PubNub Dashboard.
-
Click Create New App.
-
Give your app a name, and select Chat App as the app type.
-
Select a region to store your user data (e.g. Portland).
-
Click Create.
-
Click your new app to open its settings, then click its keyset.
-
Locate the Publish and Subscribe keys. Include these keys in this project's
.env
file.
-
Clone the GitHub repository.
git clone https://github.com/pubnub/flutter-ref-app-simple-chat.git
-
Add
.env
file with keyset values as described in.env.sample
.PUBNUB_SUBSCRIBE_KEY="<Enter Your PubNub Publish Key Here>" PUBNUB_PUBLISH_KEY="<Enter Your PubNub Subscribe Key Here>"
-
Install the dependencies.
cd flutter-ref-app-simple-chat flutter pub get
-
Start an simulator or connect your device and run application with selected device.
flutter run
Visit the PubNub Dart SDK Docs page for more information about how to use PubNub Dart SDK. Please refer Flutter Install page for flutter framework and simulator setup.