embrace 1.4.0 copy "embrace: ^1.4.0" to clipboard
embrace: ^1.4.0 copied to clipboard

A comprehensive observability and monitoring platform for iOS and Android apps built with Flutter.

example/lib/main.dart

import 'package:embrace/embrace.dart';
import 'package:embrace_example/breadcrumbs.dart';
import 'package:embrace_example/errors.dart';
import 'package:embrace_example/isolates.dart';
import 'package:embrace_example/last_run_end_state.dart';
import 'package:embrace_example/logs.dart';
import 'package:embrace_example/moments.dart';
import 'package:embrace_example/navigation.dart';
import 'package:embrace_example/network.dart';
import 'package:embrace_example/push_notifications.dart';
import 'package:embrace_example/session_properties.dart';
import 'package:embrace_example/user.dart';
import 'package:embrace_example/views.dart';
import 'package:flutter/material.dart';

Future<void> main() async {
  await Embrace.instance.start(() => runApp(const EmbraceDemo()));
}

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: EmbraceMenu());
  }
}

class EmbraceMenu extends StatefulWidget {
  const EmbraceMenu({Key? key}) : super(key: key);

  @override
  State<EmbraceMenu> createState() => _EmbraceMenuState();
}

class _EmbraceMenuState extends State<EmbraceMenu> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Embrace Example App'),
      ),
      body: Padding(
        padding: const EdgeInsets.all(8),
        child: Center(
          child: ListView(
            children: <Widget>[
              ElevatedButton(
                onPressed: Embrace.instance.endStartupMoment,
                child: const Text('End Startup Moment'),
              ),
              ElevatedButton(
                onPressed: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute<BreadcrumbDemo>(
                      builder: (context) => const BreadcrumbDemo(),
                    ),
                  );
                },
                child: const Text('Breadcrumbs'),
              ),
              ElevatedButton(
                onPressed: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute<PushNotificationsDemo>(
                      builder: (context) => const PushNotificationsDemo(),
                    ),
                  );
                },
                child: const Text('Push Notifications'),
              ),
              ElevatedButton(
                onPressed: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute<LogsDemo>(
                      builder: (context) => const LogsDemo(),
                    ),
                  );
                },
                child: const Text('Logs'),
              ),
              ElevatedButton(
                onPressed: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute<MomentsDemo>(
                      builder: (context) => const MomentsDemo(),
                    ),
                  );
                },
                child: const Text('Moments'),
              ),
              ElevatedButton(
                onPressed: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute<ViewsDemo>(
                      builder: (context) => const ViewsDemo(),
                    ),
                  );
                },
                child: const Text('Views'),
              ),
              ElevatedButton(
                onPressed: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute<ErrorDemo>(
                      builder: (context) => const EmbraceNavigationDemo(),
                    ),
                  );
                },
                child: const Text('Navigation'),
              ),
              ElevatedButton(
                onPressed: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute<UserDemo>(
                      builder: (context) => const UserDemo(),
                    ),
                  );
                },
                child: const Text('User'),
              ),
              ElevatedButton(
                onPressed: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute<SessionPropertiesDemo>(
                      builder: (context) => const SessionPropertiesDemo(),
                    ),
                  );
                },
                child: const Text('Session Properties'),
              ),
              ElevatedButton(
                onPressed: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute<NetworkDemo>(
                      builder: (context) => const NetworkDemo(),
                    ),
                  );
                },
                child: const Text('Network'),
              ),
              ElevatedButton(
                onPressed: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute<ErrorDemo>(
                      builder: (context) => const ErrorDemo(),
                    ),
                  );
                },
                child: const Text('Errors'),
              ),
              ElevatedButton(
                onPressed: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute<ErrorDemo>(
                      builder: (context) => const IsolatesDemo(),
                    ),
                  );
                },
                child: const Text('Isolate Errors'),
              ),
              ElevatedButton(
                onPressed: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute<ErrorDemo>(
                      builder: (context) => const LastRunEndStateDemo(),
                    ),
                  );
                },
                child: const Text('Last session end state'),
              ),
              ElevatedButton(
                onPressed: Embrace.instance.endSession,
                child: const Text('endSession'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
12
likes
0
pub points
88%
popularity

Publisher

verified publisherembrace.io

A comprehensive observability and monitoring platform for iOS and Android apps built with Flutter.

Homepage

License

unknown (license)

Dependencies

embrace_android, embrace_ios, embrace_platform_interface, flutter, http

More

Packages that depend on embrace