Interacting with the Copilot.cx SDK in Dart
Use Copilot.cx SDK through dart code
- Inside your project, create a MethodChannel
const channel = MethodChannel('myProjectChannelName');
The Channel name should be the same on all sided (iOS, Android and Flutter).
- Add add functions that will invoke the native code through the MethodChannel(iOS and Android)
Future<void> _signup() async {
    try {
        var email = "aa@bbb.com";
        var password = "asdf123";
        var firstName = "Steve";
        var lastName = "Bobson";
        var result = await channel.invokeMethod("signup", {
            "email": email,
            "password": password,
            "firstName": firstName,
            "lastName": lastName
        });
    } on PlatformException catch(e) {
      //Handle error
    }
}
Future<void> _login() async {
    try {
        var email = "aa@bbb.com";
        var password = "asdf123";
        var result = await channel.invokeMethod("login", {
            "email": email,
            "password": password
        });
    } on PlatformException catch(e) {
      //Handle error
    }
}
Future<void> _logout() async {
    try {
        var reasult = await channel.invokeMethod("logout");
    } on PlatformException catch(e) {
      //Handle error
    }   
}
void _sendEvent() {
    var eventName = "eventName";
    var eventParams = {
        "key1": "value1",
        "key2": "value2"
    };
    channel.invokeMethod("sendEvent", {
        "eventName": eventName,
        "eventParams": eventParams}
    );
}