From 36fec2cdbdb0e21aa3f068b5d58eb2de0f8f3409 Mon Sep 17 00:00:00 2001 From: Sebastian Podjasek Date: Thu, 27 Jun 2024 15:32:25 +0200 Subject: [PATCH] chore(docs): clarify that handler instance should be kept with state --- packages/flutter_password_scoring/README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/flutter_password_scoring/README.md b/packages/flutter_password_scoring/README.md index 6f28aaa..a92af55 100644 --- a/packages/flutter_password_scoring/README.md +++ b/packages/flutter_password_scoring/README.md @@ -23,10 +23,15 @@ Use `PasswordScoringBuilder` to build your UI. Take a look at example code if you wan't to customize dictionaries and other options based on `Locale`. ```dart -PasswordScoringBuilder( - handler: kIsWeb +/// Keep in mind that when using Isolate based handler it's +/// crucial to keep it final in state, so it won't be +/// recreated on every call to [build]. +final handler = kIsWeb ? PasswordScoringHandler() - : PasswordScoringIsolateHandler(), + : PasswordScoringIsolateHandler(); + +PasswordScoringBuilder( + handler: handler, loadingPlaceholder: const Center( child: CircularProgressIndicator(), ),