flutter_appcenter 1.0.2 flutter_appcenter: ^1.0.2 copied to clipboard
Support Android/iOS to Build, Test, and Distribute, Analytics and Diagnostics services.
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:flutter_appcenter/flutter_appcenter.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String initResult = '...';
bool isEnabledForDistribute = false;
@override
void initState() {
super.initState();
initPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
FlutterAppCenter.init(
appSecretAndroid: '2535dcc1-777c-490c-a8a5-d9c36db1f08a',//'Your Android App Secret',
appSecretIOS: 'e02b9804-58cc-4233-be71-129e411e6d39',//'Your iOS App Secret'
usePrivateTrack: false,
automaticCheckForUpdate: true,
).then((res) async{
bool enable = await FlutterAppCenter.isEnabledForDistribute();
setState((){
initResult = res;
isEnabledForDistribute = enable;
});
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Futter Appcenter'),
),
body: Center(
child: Text('Running on: FlutterAppCenter v2.0.0 \nresult: $initResult \nApp Center Distribute is ${isEnabledForDistribute ? 'enable' : 'disable'}'),
),
),
);
}
}