Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/src/loading_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,13 @@ class _LoadingButtonState extends State<LoadingButton>
try {
_stateSubject.add(ActionState.loading);
await widget.onPressed?.call();
_stateSubject.add(ActionState.success);
if (mounted) {
_stateSubject.add(ActionState.success);
}
} catch (error) {
_stateSubject.add(ActionState.error);
if (mounted) {
_stateSubject.add(ActionState.error);
}
widget.onError?.call(error);

if (_config.debugMode) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: loading_icon_button
description: Loading button with icon and text in Flutter. It's working on all flutter platforms. It's a simple way to show a loading button.
version: 1.0.2
version: 1.0.3
homepage: https://itsarvind.dev/
issue_tracker: https://github.com/itsarvinddev/loading_icon_button/issues
repository: https://github.com/itsarvinddev/loading_icon_button.git
Expand Down