Skip to content

Commit

Permalink
docs(readme): add short section about hot restart
Browse files Browse the repository at this point in the history
  • Loading branch information
benthillerkus committed Apr 17, 2022
1 parent 772730e commit 0e52401
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion example/README.md
Expand Up @@ -92,4 +92,14 @@ BetrayalLogConfig.allowIndividualLevels();
BetrayalLogConfig.level = "OFF";
```

To learn more about logging in *betrayal* have a look at the implementation in [logging.dart](https://github.com/benthillerkus/betrayal/blob/main/lib/src/logging.dart).
To learn more about logging in *betrayal* have a look at the implementation in [logging.dart](https://github.com/benthillerkus/betrayal/blob/main/lib/src/logging.dart).

## Why are my icons still there after restarting the app?

There is no hook for plugin devs to detect a hot restart. The best we can do is to reset state once the restarted app starts to interact with the library again and to provide an optional reset method users can call before `runApp` runs.

```dart
// hot restart is only possible in debug mode
if (kDebugMode) TrayIcon.clearAll();
runApp(const MyApp());
```

0 comments on commit 0e52401

Please sign in to comment.