Flutter Integration
Installation
Add dependencies to pubspec.yaml:
PUBSPEC.YAML
dependencies:
flutter:
sdk: flutter
url_launcher: ^6.2.1
flutter_inappwebview: ^6.0.0
SDK Implementation
Create lib/lootlycasher_sdk.dart:
LOOTLYCASHER_SDK.DART
import 'package:url_launcher/url_launcher.dart';
class LootlyCasherSDK {
static final LootlyCasherSDK _instance = LootlyCasherSDK._internal();
factory LootlyCasherSDK() => _instance;
LootlyCasherSDK._internal();
static const String baseURL = 'https://lootlycasher.online';
String _apiKey = '';
String _userId = '';
String _deviceId = '';
bool _sandbox = false;
void initialize({required String apiKey, required String userId,
String deviceId = '', bool sandbox = false}) {
_apiKey = apiKey;
_userId = userId;
_deviceId = deviceId;
_sandbox = sandbox;
print('LootlyCasherSDK initialized for user: $userId');
}
Future<void> showOfferwall() async {
final sandboxParam = _sandbox ? '&sandbox=1' : '';
final url = Uri.parse(
'$baseURL/api/offerwall/$_apiKey?user_id=$_userId&device_id=$_deviceId$sandboxParam'
);
if (await canLaunchUrl(url)) {
await launchUrl(url, mode: LaunchMode.inAppWebView);
}
}
}