Skip to main content

Installation

Learn how to add Shake to your Flutter app.

note

Shake supports post Flutter 1.12 projects. If your project was created with the older version of Flutter, please migrate your project to the new Android APIs via official guide first.

Create a new app on Dashboard

Visit your Shake Dashboard and add a new Android/iOS Flutter app by clicking the + button in the sidebar. Once you're done, you're ready to proceed with the steps below.

Add Shake dependency to your pubspec.yaml file

Add Shake as a dependency:

flutter pub add shake_flutter

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

pubspec.yaml
dependencies:
shake_flutter: ^

Initialize Shake

Call Shake.start() method in your main.dart file. Replace your-api-client-id and your-api-client-secret with the actual values you have in your workspace administration:

main.dart
import 'package:shake_flutter/shake_flutter.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
Shake.start('your-api-client-id', 'your-api-client-secret');
runApp(Home());
}

Build and run your project by selecting Run โ†’ Run in the menu bar.

Conditional initialization

We recommend initializing Shake in the entry point of your app. However, depending on your app, you'll want to initialize Shake just in a specific conditions, depending on your app data. You can do it as shown in the example below when your app data is available:

main_screen.dart
import 'package:shake_flutter/shake_flutter.dart';
class _MainScreenState extends State<MainScreen> {
@override
void initState() {
super.initState();
if (User.isTester) {
Shake.start('your-api-client-id', 'your-api-client-secret');
}
}

Visit your Shake dashboard

Follow the instructions there to send your first feedback with Shake and you're all set.

SDK customizations

Now that Shake SDK is in your app and you have sent the first feedback for fun, everything else is optional. As the next step, try the three most popular SDK customizations: