Venixs_SDK
Venixs flutter Wrapper
Features
This library implements a wrapper on Venixs Chat SDK provided by aiding communication from your customers to you.
Getting Started
Install package by adding Venixs_SDK to your pubspec.yaml file
To setup this project for android follow these steps:
android.useAndroidX=true
android.enableJetifier=true
android {
minSdkVersion 19 # Set to 19 or higher
...
}
final Venixs venixSdk = Venixs.instance;
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((_) async {
// TODO: Fetch and put your Venixs public api key here
await Venixs.initializeInterface(publicKey: '<PUBLIC KEY HERE>');
runApp(const MyApp());
},
);
}
...
venixSdk.initiate(
context,
email: 'example@email.com',
firstName: 'John',
lastName: 'Doe',
onCancel: (response) => print(response),
onError: (error) => print(error),
),
Just call the initiate method from your any of your favorite button widget
ElevatedButton(
onPressed: () => venixSdk.initiate(
context,
email: 'example@email.com',
firstName: 'John',
lastName: 'Doe',
onCancel: (response) => print(response),
onError: (error) => print(error),
),
child: Text('Call SDK'),
),
Ask a question and message us at support@venixs.com
Visit our website at https://venixs.com or message us at support@venixs.com
Run this command:
With Flutter:
$ flutter pub add venixs_sdk
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get
):
dependencies:
venixs_sdk: ^0.0.1
Alternatively, your editor might support flutter pub get
. Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:venixs_sdk/venixs_sdk.dart';
example/lib/main.dart
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:venixs_sdk/venixs_sdk.dart';
// import 'package:simple_fontellico_progress_dialog/simple_fontico_loading.dart';
final Venixs venixSdk = Venixs.instance;
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((_) async {
// TODO: Fetch and put your Venixs public api key here
await Venixs.initializeInterface(publicKey: '<PUBLIC KEY HERE>' /*<Account Public Api Key Here>*/);
runApp(const MyApp());
},
);
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin {
String _platformVersion = 'Unknown';
late AnimationController _controller;
@override
void initState() {
super.initState();
initPlatformState();
_controller = AnimationController(
vsync: this,
duration: const Duration(seconds: 1),
)..repeat();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
// We also handle the message potentially returning null.
try {
// platformVersion =
// await venixSdk.getPlatformVersion() ?? 'Unknown platform version';
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
if (!mounted) return;
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Venixs AI Chat Test'),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () => venixSdk.initiate(
context,
email: 'example@gmail.com',
firstName: 'Test',
lastName: 'Test 1',
userRef: 'userGeneratedRef',
onCancel: (response) {
print(response);
},
onError: (error) => print(error),
),
child: const Text('Call SDK'),
),
],
),
],
),
);
}
}
Download details:
Author: