Shakebug Flutter SDK
A Flutter plugin that provides crash‑reporting, feedback, and analytics via Shakebug. It works by detecting a device shake, capturing a screenshot, allowing annotation, optional screen‑recording, and submitting a bug report—all without leaving the app.
📦 Installation
Add the package to your pubspec.yaml:
dependencies:
shakebug: ^1.0.6
Run:
flutter pub get
🚀 Quick Start
Required native permissions
Android
Add the following permissions to android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.VIBRATE"/>
If you enable screen‑capture on Android 11+, also add:
<uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT"/>
iOS
Update ios/Runner/Info.plist with usage descriptions for camera and microphone (required for screenshot and optional video capture):
<key>NSCameraUsageDescription</key>
<string>Shakebug captures screenshots and optional video for bug reports.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Shakebug records audio when video capture is enabled.</string>
Import SDK files:
import 'package:shakebug/shakebug.dart';
Wrap your app with ShakebugSDK to enable shake detection:
ShakebugSDK(
androidAppKey: 'your_android_appkey',
iosAppKey: 'your_ios_appkey',
child: MaterialApp(
home: const HomeScreen(),
),
// Optional customisation (see **Properties** below)
);
⚙️ Properties (Constructor Parameters)
| Property | Type | Default | Description |
|---|---|---|---|
child |
Widget |
required | The root widget of your app. |
androidAppKey |
String? |
null |
Android‑specific API key. |
iosAppKey |
String? |
null |
iOS‑specific API key. |
themeColor |
Color |
Color(0xFF1AD2E2) |
Accent colour used in the SDK UI. |
changeSDKScreenTitle |
List<String> |
["Annotate your bug", "Add details"] |
Titles shown on the annotation screen. |
allowToReportBugByShakingMobiles |
bool |
true |
Enable shake‑to‑capture. |
allowToReportBugByScreenCapture |
bool |
false |
Enable capture via native screen‑capture events. |
allowCrashReport |
bool |
true |
Enable automatic crash reporting. |
makeLogEnabled |
bool |
false |
Enable internal SDK logging. |
shakebugLanguage |
String? |
null (uses device locale) |
Force a specific language. |
setShakebugSDKEndPointURL |
List<String> |
["your_url", "your_key"] |
Override the base API URL and API key at runtime. |
🛠️ Advanced Usage
Logging custom events (addEventKey)
Attach arbitrary key‑value pairs to a crash or feedback session for analytics or extra context:
await ShakebugSDK.addEventKey(name: 'button_clicked', value: 'login_submit');
Fetching remote configuration (fetchRemoteCodeValue)
Use Shakebug’s remote‑config feature to retrieve values at runtime:
final remote = await ShakebugSDK.fetchRemoteCodeValue('welcome_message');
print('Remote message: $remote');
Setting a custom user session (setcustomUser)
Associate a custom identifier (e.g., user ID or email) with the current session:
await ShakebugSDK.setcustomUser(
id: '12345',
name: 'John Doe',
email: 'john@example.com',
);
📄 License
MIT © Shakebug(Softnoesis) Team. See the LICENSE file for details.
Libraries
- shakebug
- ShakeBug SDK — shake-to-report bug capture for Flutter.