Flutter App with Quash Integration
This README provides instructions on how to integrate Quash SDK into your Flutter application to capture errors, enable screen recording, and intercept network calls.
Getting Started
Follow the steps below to set up Quash SDK in your Flutter app.
1. Capture All Errors
To capture all errors occurring in the app, wrap your runApp
call with runZonedGuarded
. This ensures that any uncaught errors are logged and handled appropriately.
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_quash_sdk/flutter_quash_sdk.dart';
void main() {
runZonedGuarded(() async {
runApp(const MyApp());
}, (error, stackTrace) {
FlutterError.dumpErrorToConsole(
FlutterErrorDetails(stack: stackTrace, exception: error),
);
FlutterQuashSdk().getBugReportingScreen();
});
}
1.2. Initialize Quash SDK
Initialize the Quash SDK in the initState method of your main widget. Obtain your API key from the Quash website and replace "your_api_key_here" with your actual key. dart
import 'package:flutter/material.dart';
import 'package:flutter_quash_sdk/flutter_quash_sdk.dart';
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final _flutterQuashSdkPlugin = FlutterQuashSdk();
@override
void initState() {
super.initState();
_flutterQuashSdkPlugin.intializeApp("your_api_key_here", true); // production
}
@override
Widget build(BuildContext context) {
return MaterialApp(
navigatorKey: _flutterQuashSdkPlugin.getNavigatorKey(),
home: FabInjector(child: SplashScreen()), // Replace SplashScreen with your own widget
);
}
}
- Enable Screen Recording To enable screen recording functionality in your app, use the navigatorKey provided by Quash SDK and wrap your home widget with FabInjector. dart
import 'package:flutter/material.dart';
import 'package:flutter_quash_sdk/flutter_quash_sdk.dart';
class MyApp extends StatelessWidget {
final _flutterQuashSdkPlugin = FlutterQuashSdk();
@override
Widget build(BuildContext context) {
return MaterialApp(
navigatorKey: _flutterQuashSdkPlugin.getNavigatorKey(),
home: FabInjector(child: SplashScreen()), // Replace SplashScreen with your own widget
);
}
}
- Intercept Network Calls To log all network calls made by your app, add the QuashCurlInterceptor to your Dio instance.
import 'package:dio/dio.dart';
import 'package:flutter_quash_sdk/flutter_quash_sdk.dart';
final Dio _dio = Dio();
void setupDio() {
_dio.interceptors.add(QuashCurlInterceptor());
}
Libraries
- core/base_use_case
- core/core_ui/base_view
- core/core_ui/base_view_out_state
- core/core_ui/base_view_state
- core/core_ui/disposable_stream_subscripton
- core/core_ui/disposable_widget
- core/core_ui/empty_view_out_state
- core/helpers
- core/interceptor/quash_interceptor
- domain/repositories/entities/item_model
- domain/repositories/entities/org_users_entity
- domain/repositories/entities/package_details
- domain/repositories/entities/quash_network_data
- domain/repositories/entities/response_bug
- domain/repositories/quash_factory
- domain/repositories/quash_repo
- domain/repositories/quash_view_factory
- flutter_quash_sdk
- flutter_quash_sdk_method_channel
- flutter_quash_sdk_platform_interface
- flutter_quash_sdk_web
- infra/module/quash_core_module
- infra/module/quash_locator
- infra/module/screen_capture
- infra/network/network_api
- infra/quash_constants
- infra/repo_impl/quash_repo_impl
- infra/repo_impl/quash_repo_mock_impl
- ui/bug_reporting/bug_reporting
- ui/bug_reporting/bug_reporting_view
- ui/bug_reporting/bug_reports_list_view/get_bugs_screen
- ui/bug_reporting/bug_reports_list_view/get_bugs_screen_strings
- ui/bug_reporting/bug_reports_list_view/get_bugs_screen_view
- ui/bug_reporting/quash_shimmer
- ui/bug_reporting/screenshot_displayer/screenshot_list
- ui/bug_reporting/video_player_widget
- ui/bug_reporting/voice_recorder_
- usecases/delete_report_usecase
- usecases/get_device_details
- usecases/get_org_users_usecase
- usecases/get_reported_bugs_usecase
- usecases/report_bug_usecase
- usecases/update_bug_usecase
- utils/circle_container_with_text
- utils/quash_colors