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.

Set user properties

You can set properties to describe the users of your app. Check the preset defined for the keys we support. Read more about the AdropMetrics.

var key = "YOUR_PROPERTY_KEY";
var value = "YOUR_PROPERTY_VALUE";
AdropMetrics.setProperty(key, value);

Last updated