Flutter

Initialize Adrop

  1. Import the Adrop

  2. Initialize the Adrop early in the project’s run-time lifecycle, preferably at launch.

import 'package:adrop_ads_flutter/adrop_ads_flutter.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    initialize();
  }

  Future<void> initialize() async {
    // true for production
    await Adrop.initialize(false);
  }
}

When production is false, you can check error logs.

Log Events

You can log custom event to define the users of your app. Read more about the AdropMetrics.

AdropMetrics.logEvent("event_name", {
    "data_key_1": 1,
    "data_key_2": 1.2,
    "data_key_3": true,
    "data_key_4": "value_text"
});

Last updated