app_center_plugin 1.0.0 copy "app_center_plugin: ^1.0.0" to clipboard
app_center_plugin: ^1.0.0 copied to clipboard

PlatformAndroidiOS
outdated

A AppCenter Flutter plugin with Analytics and Crashes.

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:app_center_plugin/app_center_plugin.dart';


const androidSecret = '043be909-44a3-4675-b8b3-3078cb55d379';
const iOSSecret = '894914f3-91d8-48c0-a929-d02e8b5b2178';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final secret = Platform.isAndroid ? androidSecret : iOSSecret;
  await AppCenter.start(secret);
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    AppCenter.trackEvent('MyApp');
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
      AppCenter.trackEvent(
          'Increment Counter', {'counter': _counter.toString()});
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}
6
likes
130
pub points
3%
popularity

Publisher

verified publishereronsoft.com

A AppCenter Flutter plugin with Analytics and Crashes.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on app_center_plugin