flutter_sdk_app 0.1.0
flutter_sdk_app: ^0.1.0 copied to clipboard
A Flutter package for Geosentry SDK integration via platform channels.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:flutter_sdk_app/flutter_sdk_app.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Geosentry SDK Example',
theme: ThemeData(primarySwatch: Colors.blue),
home: const GeosentryExamplePage(),
);
}
}
class GeosentryExamplePage extends StatefulWidget {
const GeosentryExamplePage({Key? key}) : super(key: key);
@override
State<GeosentryExamplePage> createState() => _GeosentryExamplePageState();
}
class _GeosentryExamplePageState extends State<GeosentryExamplePage> {
String _sdkResponse = 'SDK Not Initialized';
Future<void> _initializeSdk() async {
try {
final result = await GeosentrySDK.initializeSDK(
apiKey: 'YOUR_API_KEY',
cipherKey: 'YOUR_CIPHER_KEY',
userID: 'YOUR_USER_ID',
);
setState(() {
_sdkResponse = result;
});
} catch (e) {
setState(() {
_sdkResponse = e.toString();
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Geosentry SDK Example')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('SDK Initialization Status:'),
Text(_sdkResponse, textAlign: TextAlign.center),
const SizedBox(height: 20),
ElevatedButton(
onPressed: _initializeSdk,
child: const Text('Initialize SDK'),
),
],
),
),
);
}
}