Back to Flutter SDK

Flutter SDK Setup

Get started with Solvof in your Flutter application. This guide covers installation and initialization of the SDK for iOS and Android.

1. Installation

Add the solvof_flutter package to your pubspec.yaml file or run the following command in your terminal:

flutter pub add solvof_flutter

This will automatically add the latest version of the SDK to your dependencies.

Note: For iOS, you may need to run pod install inside your ios directory after adding the package.

2. Initialization

Before you can track any events, you need to initialize the Solvof SDK with your Project API Key. The best place to do this is in your main.dart file before calling runApp().

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

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  // Initialize Solvof SDK
  await Solvof.init(
    apiKey: 'YOUR_PROJECT_API_KEY',
    // Optional configuration
    config: SolvofConfig(
      debugMode: true, // Enable for detailed logs during development
      trackLifecycleEvents: true, // Automatically track App Opened, App Backgrounded, etc.
    )
  );

  runApp(const MyApp());
}

You can find your Project API Key in your Dashboard Settings under the API Keys tab.

3. Next Steps

Now that the SDK is installed and initialized, you can start identifying users and tracking custom events throughout your app.