flutter_bugly 1.1.1 copy "flutter_bugly: ^1.1.1" to clipboard
flutter_bugly: ^1.1.1 copied to clipboard

Flutter plugin for Tencent Bugly, Crash monitoring, Crash analysis, exception reporting, application update, data statistics, etc

example/lib/main.dart

import 'dart:async';

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

void main() {
  runZonedGuarded(() {
    WidgetsFlutterBinding.ensureInitialized();
    runApp(MyApp());
  }, (exception, stackTrace) {
    FlutterBugly.uploadException(
      type: exception.runtimeType.toString(),
      message: exception.toString(),
      detail: stackTrace.toString(),
    );
  });
  // FlutterBugly.postCatchedException(() {
  //   WidgetsFlutterBinding.ensureInitialized();
  //   runApp(MyApp());
  // },debugUpload: true);
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(home: HomePage());
  }
}

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

  @override
  State<StatefulWidget> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  String _platformVersion = 'Unknown';

  @override
  void initState() {
    super.initState();
    FlutterBugly.init(
      androidAppId: "af161f0da4",
      iOSAppId: "your app id",
      ohosAppId: "your ohos app id",
      deviceId: "your ohos device id",
      appKey: "your ohos bugly app key",
    ).then((_result) {
      setState(() {
        _platformVersion = _result.message;
        print(_result.appId);
      });
    });
    FlutterBugly.setUserId("user id");
    FlutterBugly.putUserData(key: "key", value: "value");
    int tag = 9527;
    FlutterBugly.setUserTag(tag);
    FlutterBugly.setAppVersion('app version');
    // autoCheckUpgrade 为 true 时,可以不用调用
    // if (mounted) _checkUpgrade();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Plugin example app')),
      body: GestureDetector(
        onTap: () {
          FlutterBugly.log(tag: "11111", message: "22222",level:LogLevel.INFO);
          throw FlutterError('test exception');
        },
        child: Center(
          child: Text('init result: $_platformVersion\n'),
        ),
      ),
    );
  }
}
69
likes
125
points
1.41k
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for Tencent Bugly, Crash monitoring, Crash analysis, exception reporting, application update, data statistics, etc

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_bugly

Packages that implement flutter_bugly