developerpact 0.1.1
developerpact: ^0.1.1 copied to clipboard
Closed-testing engagement reporter for developerpact.com. Reports a random install id and daily foreground seconds for testers paired through the platform; ordinary users generate no traffic. Android only.
import 'package:developerpact/developerpact.dart';
import 'package:flutter/material.dart';
void main() {
// The whole integration: one line, before runApp. It returns at once and
// never throws; the Future is only awaited here to show the status on screen.
final status = DeveloperPact.start();
runApp(ExampleApp(status: status));
}
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key, required this.status});
final Future<DeveloperPactStatus> status;
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'developerpact example',
home: Scaffold(
appBar: AppBar(title: const Text('developerpact example')),
body: Center(
child: FutureBuilder<DeveloperPactStatus>(
future: status,
builder: (context, snapshot) {
final s = snapshot.data;
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
s == null ? 'starting…' : s.name,
style: Theme.of(context).textTheme.headlineMedium,
),
const SizedBox(height: 12),
Text(switch (s) {
DeveloperPactStatus.paired =>
'This install reports daily foreground time.',
DeveloperPactStatus.notPaired =>
'Not paired: nothing is sent. Open a testing link or '
'tap Pair on developerpact.com to pair.',
DeveloperPactStatus.unsupported =>
'Not Android: the SDK does nothing here.',
null => '',
}, textAlign: TextAlign.center),
const SizedBox(height: 24),
Text(
'Supported on this platform: ${DeveloperPact.isSupported}',
style: Theme.of(context).textTheme.bodySmall,
),
],
);
},
),
),
),
);
}
}