Skip to content

Commit

Permalink
Fix functional extender #150
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcmgit committed Feb 16, 2024
1 parent 36ebf78 commit f2901ed
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion example/lib/screens/file_explorer/file_explorer_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ class _FileExplorerCardState extends State<FileExplorerCard> {
if (_expanded) ...[
_buildThumbnail(size: 50),
_buildDocumentMetadata(),
_buildAvailableActions()
_buildAvailableActions(),
] else
_buildDocumentSimplifiedTile(),
],
Expand Down
2 changes: 1 addition & 1 deletion example/lib/screens/file_explorer/file_explorer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class _FileExplorerPageState extends State<FileExplorerPage> {
_buildDocumentList()
else
_buildEmptyFolderWarning(),
]
],
],
);
}
Expand Down
4 changes: 2 additions & 2 deletions example/lib/screens/granted_uris/granted_uri_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class _GrantedUriCardState extends State<GrantedUriCard> {
ActionButton(
'Open file picker here',
onTap: () => openDocumentTree(initialUri: widget.permissionUri.uri),
)
),
];
}

Expand Down Expand Up @@ -193,7 +193,7 @@ class _GrantedUriCardState extends State<GrantedUriCard> {
didUpdateDocument: (updatedDocumentFile) {
documentFile = updatedDocumentFile;
},
)
),
],
);
}
Expand Down
10 changes: 9 additions & 1 deletion lib/src/common/functional_extender.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ extension FunctionalExtender<T> on T? {
T? takeIf(bool Function(T) f) {
final T? self = this;

return self != null && f(self) ? self : null;
if (self == null) {
return null;
}

if (f(self)) {
return self;
}

return null;
}
}

Expand Down

0 comments on commit f2901ed

Please sign in to comment.