Skip to content

Commit

Permalink
updated audits screen exception when bloc is already closed and attem…
Browse files Browse the repository at this point in the history
…pting to add a event to the listener
  • Loading branch information
biozal committed Feb 8, 2024
1 parent c699c2a commit 4470dcc
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 20 deletions.
28 changes: 18 additions & 10 deletions src/lib/features/audit/bloc/audit_list_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ class AuditListBloc extends Bloc<AuditListEvent, AuditListState> {

final AuditRepository _repository;
var isInitialState = true;
var _isClosed = false;

@override
Future<void> close() {
_isClosed = true;
return super.close();
}

Future<void> _onLoaded(
AuditListLoadedEvent event, Emitter<AuditListState> emit) async {
Expand Down Expand Up @@ -55,17 +62,18 @@ class AuditListBloc extends Bloc<AuditListEvent, AuditListState> {
var items = <Audit>[];
// <5>
var results = await change.results.allResults();
//<6>
for (var result in results) {
// <7>
var map = result.toPlainMap();
var dao = AuditDao.fromJson(map);
// <8>
items.add(dao.item);
if (!_isClosed) {
//<6>
for (var result in results) {
// <7>
var map = result.toPlainMap();
var dao = AuditDao.fromJson(map);
// <8>
items.add(dao.item);
}
// <9>
add(AuditListLoadedEvent(items: items));
}
// <9>
add(AuditListLoadedEvent(items: items));

});
}
} catch (e) {
Expand Down
15 changes: 8 additions & 7 deletions src/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@ PODS:
- cbl_flutter_ce (0.0.1):
- FlutterMacOS
- FlutterMacOS (1.0.0)
- path_provider_macos (0.0.1):
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS

DEPENDENCIES:
- cbl_flutter_ce (from `Flutter/ephemeral/.symlinks/plugins/cbl_flutter_ce/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
- path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)

EXTERNAL SOURCES:
cbl_flutter_ce:
:path: Flutter/ephemeral/.symlinks/plugins/cbl_flutter_ce/macos
FlutterMacOS:
:path: Flutter/ephemeral
path_provider_macos:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos
path_provider_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin

SPEC CHECKSUMS:
cbl_flutter_ce: 39d702a754b2dd00d42418106a56c1fab9a23f32
FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811
path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c

PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7

COCOAPODS: 1.11.3
COCOAPODS: 1.14.3
5 changes: 3 additions & 2 deletions src/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXAggregateTarget section */
Expand Down Expand Up @@ -203,7 +203,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
33CC10EC2044A3C60003C045 = {
Expand Down Expand Up @@ -256,6 +256,7 @@
/* Begin PBXShellScriptBuildPhase section */
3399D490228B24CF009A79C7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down

0 comments on commit 4470dcc

Please sign in to comment.