tms_preload_helper 1.0.0
tms_preload_helper: ^1.0.0 copied to clipboard
Preloads a remote image on startup and, when it is missing, resolves a Traffic Management System (TMS) offer link and opens it in an in-app tab.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:tms_preload_helper/tms_preload_helper.dart';
void main() {
// Both URLs are derived from this one domain:
// https://example.com/img/loading.webp (the probe)
// https://example.com/link.txt (the TMS API host)
TmsPreloadHelper.bootstrap(
domain: 'exemple.com',
app: const MyApp(),
options: const TmsOptions(
mediaSource: 'organic',
),
debug: true,
);
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(body: Center(child: Text('App'))),
);
}
}