bugbattle_sdk 3.1.2
bugbattle_sdk: ^3.1.2 copied to clipboard

The BugBattle SDK for Flutter is the easiest way to integrate BugBattle into your apps!

example/lib/main.dart

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

import 'package:bugbattle_sdk/bugbattle_sdk.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  Future<void> initPlatformState() async {
    try {
      // Init Bugbattle with token and ActivationMethod
      BugBattle.initWithToken("79l0KJpYzRhU9OwXcM66f9IfGGK193MD", ActivationMethod.SCREENSHOT);
      // BugBattle.initializeMany(
      //     "YOUR_TOKEN", [ActivationMethod.SCREENSHOT, ActivationMethod.SHAKE]);
      BugBattle.enableReplays();

      // // Customizations
      BugBattle.setCustomerEmail('hello@bugbattle.io');

      const Map<String, dynamic> customData = {
        'role': 'USER',
        'data': 'More custom data'
      };
      BugBattle.attachCustomData(customData);

      BugBattle.enablePrivacyPolicy(true);
      BugBattle.setPrivacyPolicyUrl("https://awesomeproject.com/privacypolicy");

      BugBattle.setNavigationBarTint(Colors.blue);
      BugBattle.setNavigationTint(Colors.black);
      BugBattle.setNavigationBarTitleColor(Colors.black);

     // BugBattle.setApiUrl("https://internalbugbattle.server");

      BugBattle.setLanguage("de");
    } catch (err) {
      print(err);
    }
  }

  // to start bug reporting manually
  void reportBug() {
    BugBattle.startBugReporting();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Bugbattle Example'),
        ),
        body: Center(
          child: GestureDetector(
            onTap: () {
              reportBug();
            },
            child: Container(
              alignment: Alignment.center,
              height: 50,
              width: 150,
              color: Color(0xFF3578e5),
              child: Text(
                'Report Bug',
                style: TextStyle(
                  color: Colors.white,
                  fontWeight: FontWeight.bold,
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
2
likes
90
pub points
52%
popularity

Publisher

bugbattle.io

The BugBattle SDK for Flutter is the easiest way to integrate BugBattle into your apps!

Homepage

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on bugbattle_sdk