app_update_flutter 0.0.1
app_update_flutter: ^0.0.1 copied to clipboard
App Update Flutter
example/lib/main.dart
import 'package:app_update_flutter/app_update_flutter.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final _appUpdateFlutterPlugin = AppUpdateFlutter();
String update = '';
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
await Future.delayed(const Duration(seconds: 10));
update = await _appUpdateFlutterPlugin.checkUpdate();
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Running on:$update'),
),
),
);
}
}