From 0e524019c94571bb4ca6eee337f5aec309c823eb Mon Sep 17 00:00:00 2001 From: Bent Hillerkus <29630575+benthillerkus@users.noreply.github.com> Date: Sun, 17 Apr 2022 17:08:50 +0200 Subject: [PATCH] docs(readme): add short section about hot restart --- example/README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/example/README.md b/example/README.md index 07368a1..a1f859b 100644 --- a/example/README.md +++ b/example/README.md @@ -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). \ No newline at end of file +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()); +```