# Getting started

VChatCloud SDK is a development kit that makes it easy to implement VChatCloud services using the Flutter framework.

If you want to build an app with chat functionality, we recommend building a client app on top of the sample app. If you already have an app and want to add chat, go through this guide to integrate chat into your app. This guide walks you through installing the chat SDK in your app, creating a channel object, and sending your first message.

If you would like to use the sample app, go to here.

First, you need to create a chat room in CMS. If the chat room has already been created, check the ChannelKey value. To create a new one, go to here.

# Send your first message

# Add dependencies

Dependencies can be added directly to pubspec.yaml or using commands.

    # Load Packages

    In the place where you will use the sdk, add the phrase below to load the package.

    import 'package:vchatcloud_flutter_sdk/vchatcloud_flutter_sdk.dart'
    
    1

    # Initializing the SDK

    After implementing a new Handler by referring to Event Handler, initialize the SDK and get a Channel object. After that, check the 'ChannelKey' found in the CMS, create a 'UserModel' object, and connect to the chat room.

    void main() async {
      var channel = VChatCloud.connect(CustomHandler());
      var history = await channel.join(UserModel(
        roomId: "YOUR_CHANNEL_KEY",
        nickName: "USER_NICKNAME",
        userInfo: {"profile":"PROFILE_IMAGE_INDEX"}, // {"profile": "1"} >> Use profile image number 1
        clientKey: "USER_UNIQUE_KEY",
      ));
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9

    # Send message

    Send a message using the sendMessage method of the Channel object.

    channel.sendMessage("Hello VChatCloud!");
    
    1
    Copyright 2022. E7Works Inc. & JOYTUNE Corp. All Rights Reserved.