okhi 1.0.1 okhi: ^1.0.1 copied to clipboard
The official OkHi Flutter library will enable you to start collecting and verifying your user's addresses.
import 'package:flutter/material.dart';
import 'package:okhi/okhi.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
final config = OkHiAppConfiguration(
branchId: "<my_branch_id>",
clientKey: "<my_client_key>",
env: OkHiEnv.sandbox,
notification: OkHiAndroidNotification(
title: "Verification in progress",
text: "Verifying your address",
channelId: "okhi",
channelName: "OkHi",
channelDescription: "Verification alerts",
),
);
OkHi.initialize(config).then((result) {
print(result);
}).onError((error, stackTrace) {
print(error);
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text("Create an address"),
),
body: OkHiLocationManager(
user: OkHiUser(phone: "+254712345678"),
onSucess: (response) {
response.startVerification(null);
},
onError: (error) {
print(error.code);
print(error.message);
},
),
),
);
}
}