DEV Community

Cover image for Supercharge Flutter Development with Bugfender: Realtime Debugging
Pranil Shah
Pranil Shah

Posted on

Supercharge Flutter Development with Bugfender: Realtime Debugging

What is Bugfender?

As per Bugfender documentation.

Bugfender is a log storage service for application developers. Bugfender collects everything happening in the application, even if it doesn't crash, in order to reproduce and resolve bugs more effectively and provide better customer support.


Key Features of Bugfender:

  1. Real-Time Logging: Bugfender allows you to see logs from devices in real-time, making it easier to catch bugs as they occur.
  2. Remote Debugging: Developers can remotely inspect and debug applications, eliminating the need to access the device physically.
  3. Device Details: Bugfender provides device-specific details, such as OS version, screen resolution, and more, aiding in pinpointing issues related to specific devices.
  4. Custom Logging Levels: Developers can categorize logs based on severity, making prioritizing and focusing on critical issues easier.

Integrating Bugfender with Flutter:
Let's walk through the process of integrating Bugfender into a Flutter application:

Install Bugfender Dependency:
Add the Bugfender dependency to your pubspec.yaml file:

dependencies:
  flutter_bugfender: ^2.1.2
Enter fullscreen mode Exit fullscreen mode

Run flutter pub get to install the package.

Initialize Bugfender: In your main.dart file, import Bugfender, and initialize it in the main function:

import 'package:flutter_bugfender/flutter_bugfender.dart';

void main() {
  Bugfender.init("YOUR_APP_KEY", enableUIEventLogging: true);
  runApp(MyApp());
}
Enter fullscreen mode Exit fullscreen mode

Note: Replace "YOUR_APP_KEY" with the key obtained from the Bugfender dashboard.

Logging Messages: Use Bugfender to log messages throughout your application:

FlutterBugfender.log("Working fine!");
FlutterBugfender.fatal("Fatal sent!");
FlutterBugfender.error("Error sent!");
FlutterBugfender.warn("Warning sent!");
FlutterBugfender.info("Info sent!");
FlutterBugfender.debug("Debug sent!");
FlutterBugfender.trace("Trace sent!");
FlutterBugfender.sendLog(
 line: 42,
 method: "someMethod()",
 file:"someFile",
 level: LogLevel.info,
 tag: "Custom tag",
 text: "This is a custom log"
);
FlutterBugfender.setDeviceString("user.email", "example@example.com");
FlutterBugfender.setDeviceInt("user.id", 32);
Flu tterBugfender.setDeviceFloat("user.pi", 3.14);
FlutterBugfender.setDeviceBool("user.enabled", true);
FlutterBugfender.removeDeviceKey("user.pi");
FlutterBugfender.sendCrash("Test Crash", "Stacktrace here!");
FlutterBugfender.sendIssue("Test Issue", "Issue value goes here!");
FlutterBugfender.sendUserFeedback("Test user feedback", "User feedback details here!");
FlutterBugfender.setForceEnabled(true);
FlutterBugfender.forceSendOnce();
FlutterBugfender.getDeviceUri());
FlutterBugfender.getSessionUri());
FlutterBugfender.getUserFeedback()); // Show a screen which asks for feedback
Enter fullscreen mode Exit fullscreen mode

These logs will be sent to the Bugfender dashboard in real-time.

Viewing Logs: Access the Bugfender dashboard to view logs from different devices, filter by log levels, and analyze the app's behavior remotely.

Image description


Benefits of Bugfender in Flutter Development:

  1. Efficient Bug Identification: Bugfender provides real-time logs, enabling developers to identify and fix bugs as they occur, reducing debugging time.
  2. Remote Debugging: Developers can remotely debug applications, making it easier to troubleshoot issues on various devices without physically accessing them.
  3. Device-Specific Insights: Bugfender offers detailed information about each device, helping developers understand and resolve issues specific to certain configurations.
  4. Custom Logging Levels: Categorizing logs by severity allows developers to focus on critical issues first, streamlining the debugging process.
  5. Streamlined Collaboration: Bugfender facilitates collaboration among team members by providing a centralized platform for log analysis, making it easier to share insights and work together to solve problems.

Conclusion:
Integrating Bugfender with your Flutter application significantly enhances the debugging process by providing real-time insights, remote debugging capabilities, and detailed device-specific information. By streamlining the identification and resolution of bugs, Bugfender proves to be a valuable tool for Flutter developers striving to create robust and error-free applications.

Flutter with Bugfender by Pranil Shah

Let's Connect and follow for more.
LinkedIn Twitter GitHub Email

Top comments (0)