🧠 DroidDex Flutter

A Flutter plugin for DroidDex β€” Blinkit’s Android performance profiling library. This plugin bridges your Flutter app with native Kotlin performance signals using MethodChannel and EventChannel.

πŸ“š Resources

πŸ”— DroidDex GitHub Repository

πŸ“° Medium Article (Blinkit Engineering)

How Blinkit Cracked Android's Performance Puzzle with Droid Dex

πŸš€ Features

πŸ“Š Get performance levels for:

  1. CPU
  2. Battery
  3. Network
  4. Storage
  5. Memory

βš–οΈ Weighted performance scoring via custom importance

πŸ” Real-time performance updates using event streams

⚑️ Simple API with enums and model wrappers

Usage

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  ...
  droid_dex_flutter: ^1.0.1

In your library add the following import:

import 'package:droid_dex_flutter/droid_dex_flutter.dart';

For help getting started with Flutter, view the online documentation.

πŸ§ͺ Example

Here's a minimal example:

final droidDex = DroidDexFlutter();
await droidDex.init();

final pairs = [
PerformanceClassWeightPair(
performanceClass: PerformanceClass.cpu,
weight: 2.0,
),
PerformanceClassWeightPair(
performanceClass: PerformanceClass.battery,
weight: 1.5,
),
];

final staticLevel = await droidDex.getWeightedPerformanceLevel(pairs);
print("Static Level: ${staticLevel.name}");

// Start real-time stream
final stream = await droidDex.getWeightedPerformanceLevelLiveData(pairs);
stream.listen((level) {
print("Live Level: ${level.name}");
});

For a complete working demo, check the example app.

🎯 API Overview

Initialization


await DroidDexFlutter().init();

Get Performance Level


Future<int> getPerformanceLevel(int performanceClass);

Weighted Performance Level


Future<int> getWeightedPerformanceLevel(List<PerformanceClassWeightPair> pairs);

Live Data

Future<Stream<int>> getPerformanceLevelLiveData(int performanceClass);

Future<Stream<int>> getWeightedPerformanceLevelLiveData(List<PerformanceClassWeightPair> pairs);

🧩 Native Dependencies

This plugin currently supports Android only. Make sure your minSdkVersion is at least 24 and that Kotlin is properly configured.

🀝 Contributing

Pull requests and issue reports are welcome! If you find a bug or have a feature request, feel free to open an issue on GitHub.