testing library
Testing utilities for native_workmanager.
Import this library only in test files and DI setup code — not in production widget/logic files.
// pubspec.yaml — no special config needed; this is part of the main package.
// In your service:
import 'package:native_workmanager/native_workmanager.dart';
import 'package:native_workmanager/testing.dart';
class SyncService {
SyncService(this._wm);
final IWorkManager _wm;
}
// Production main.dart:
final service = SyncService(NativeWorkManagerClient());
// Test file:
final fake = FakeWorkManager();
final service = SyncService(fake);
Classes
- EnqueueCall
- A single recorded FakeWorkManager.enqueue invocation.
- FakeChainRecord
- A full record of a chain that was enqueued via FakeWorkManager.beginWith.
- FakeWorkManager
- In-memory IWorkManager test double.
- IWorkManager
- Testable interface for NativeWorkManager.
- NativeWorkManagerClient
- Production IWorkManager that delegates to NativeWorkManager.