Skip to content

Commit

Permalink
Update DETECT.md
Browse files Browse the repository at this point in the history
  • Loading branch information
polina-c committed Jan 13, 2024
1 parent 1e7ff98 commit 8d84d69
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions doc/leak_tracking/DETECT.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@ Read more about leak tracking in [overview](OVERVIEW.md).
To make `testWidgts` detecting leaks in your tests, enable leak tracking in [`test/flutter_test_config.dart`](see hhttps://api.flutter.dev/flutter/flutter_test/flutter_test-library.html):

```dart
import 'dart:async';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
...
Future<void> testExecutable(FutureOr<void> Function() testMain) {
FutureOr<void> testExecutable(FutureOr<void> Function() testMain) {
LeakTesting.enable();
...
await testMain();
return testMain();
}
```

Expand All @@ -50,7 +51,7 @@ import 'package:leak_tracker/leak_tracker.dart';
...
enableLeakTracking();
MemoryAllocations.instance
FlutterMemoryAllocations.instance
.addListener((ObjectEvent event) => dispatchObjectEvent(event.toMap()));
runApp(...
Expand Down

0 comments on commit 8d84d69

Please sign in to comment.