guardlinesdk 0.1.3
guardlinesdk: ^0.1.3 copied to clipboard
Project integration Guardline SDK and API.
example/lib/main.dart
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:guardlinesdk/components/guardlineapi.dart';
import 'package:guardlinesdk/guardlinewidget.dart';
/*This is a sample main.dart file for a Flutter application that uses the Guardline SDK.
It demonstrates how to set up a basic Flutter app with the GuardlineWidget, which is used for document verification.
The app token should be replaced with your actual token for the Guardline service.
void main() {
// Ensure DemoApp is defined in ../clientsdk/DemoApp.dart and imported correctly
runApp(GuardlinePage('[YOUR TOKEN HERE]'),
);
}*/
void main() {
// Ensure DemoApp is defined in ../clientsdk/DemoApp.dart and imported correctly
runApp(MainPage());
}
class MainPage extends StatefulWidget {
const MainPage({super.key});
@override
_MainPageState createState() => _MainPageState();
}
class _MainPageState extends State<MainPage> {
final String appToken = '[YOUR_APP_TOKEN]';
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(title: const Text("Guardline Demo")),
body: SingleChildScrollView(
padding: EdgeInsets.all(16.0),
child: Builder(
builder: (BuildContext context) {
return GuardlineWidget(
appToken, // Replace with your actual token
primaryColor: Colors.orangeAccent,
onResult: (session) async {
if (kDebugMode) {
print('session: $session');
}
GuardlineApi api = GuardlineApi(appToken);
List<String> types = await api.verify(session);
for (String type in types) {
print('Verification type: $type');
dynamic data = await api.verifyWithType(session, type);
print('data for $type: $data');
}
},
);
},
),
),
),
);
}
}