Flutter SKD: Failed to Create Vapi Client after se...
# support
o
Currently we are trying to implement the Flutter SDK in our app by following the examples from the repository. After implementing we have encountered a problem with this example. The vapi SDK tries to create a client and fails after several attempts, causing the app to crash right after (see image). There are no error logs from the sdk. https://cdn.discordapp.com/attachments/1260879656882536519/1260879657381662851/Screenshot_2024-07-11_at_10.45.18.png?ex=6690ed30&is=668f9bb0&hm=05dcf79d311dd19ca8d4bbc2938af162b18d989c0479afe63626fac210b5ffbd&
v
@Onur I'm sorry to hear that you're experiencing issues with the Vapi Flutter SDK. To better assist you, I would need a bit more information about the problem. Could you please provide the following details? 1. The version of the Vapi Flutter SDK you are using. 2. The Flutter version and any other relevant environment details. 3. The specific example from the repository that you are following. 4. Any code snippets around where the client is being created, if possible without revealing sensitive information. 5. The image or error message you mentioned, as it might contain clues to the issue. Once I have this information, I'll do my best to help you resolve the problem. If the issue is complex and requires more in-depth support, I may direct you to contact support for further assistance.
You can continue this conversation by mentioning me in the message.
o
vapi: 0.0.9 Flutter: 3.22.2
Copy code
dart
Future<void> test() async {
    setState(() {
      buttonText = 'Loading...';
      isLoading = true;
    });

    try {
      if (!isCallStarted) {
        await vapi.start(assistantId: VAPI_ASSISTANT_ID);
      } else {
        await vapi.stop();
      }
    } catch (err) {
      print(err);
    }
  }
}
@User
s
@Onur I will get back to you on this.
o
Hey @Shubham Bajaj thanks!
@Shubham Bajaj any update here 👀
s
hey can you share your code/repo?
o
We are using the example from the repo:
Copy code
dart
class VapiTest extends StatefulWidget {
  const VapiTest({super.key});

  @override
  _VapiTestState createState() => _VapiTestState();
}

class _VapiTestState extends State<VapiTest> {
  late StreamSubscription _subscription;

  @override
  void initState() {
    super.initState();
    _subscription = vapi.onEvent.listen((event) {
      if (event.label == 'call-start') {
        setState(() {
          buttonText = 'End Call';
          isLoading = false;
          isCallStarted = true;
        });
        print('call started');
      }
      if (event.label == 'call-end') {
        setState(() {
          buttonText = 'Start Call';
          isLoading = false;
          isCallStarted = false;
        });
        print('call ended');
      }
      if (event.label == 'message') {
        print(event.value);
      }
    });
  }

  @override
  void dispose() {
    _subscription.cancel();
    super.dispose();
  }

  String buttonText = 'Start Call';
  bool isLoading = false;
  bool isCallStarted = false;
  Vapi vapi = Vapi(VAPI_PUBLIC_KEY);

  @override
  Widget build(BuildContext context) {
    return ElevatedButton(
      onPressed: isLoading ? null : test,
      child: Text(buttonText),
    );
  }

  Future<void> test() async {
    setState(() {
      buttonText = 'Loading...';
      isLoading = true;
    });

    try {
      if (!isCallStarted) {
        await vapi.start(assistantId: VAPI_ASSISTANT_ID);
      } else {
        await vapi.stop();
      }
    } catch (err) {
      print(err);
    }
  }
}
Also we are using flutter 3.22.2 Vapi 0.0.9 We had do to a dependecy override for permission_handler to version 11.0.0 since we are using a newer version
@Shubham Bajaj any news here ?
s
Hi @Onur for this will be connecting with you today.
At what time you can connect after 05:00PM IST?
o
If im correct thats 1pm CET that should work yes
s
@Shubham Bajaj I have the same problem too. Could you please help support?
s
@Shine can you tag me to your support ticket??
s
What do you specifically mean? Shbham I think I already called you with tag in support channel? @Shubham Bajaj
@Shubham Bajaj please help me with the same error
s
@Shine I am going through support tickets will reply to your ticket in sometime.
3 Views