π§ 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:
- CPU
- Battery
- Network
- Storage
- 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.