-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
491cbfe
commit d8a08a4
Showing
6 changed files
with
158 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
|
||
import 'app_state.dart'; | ||
|
||
class AppCubit extends Cubit<AppState> { | ||
AppCubit({ | ||
Map<String, String>? repoVersion, | ||
Map<String, String>? devVersion, | ||
Map<String, String>? uatVersion, | ||
Map<String, String>? prodVersion, | ||
}) : super(AppState( | ||
repoVersion: repoVersion ?? {}, | ||
devVersion: devVersion ?? {}, | ||
uatVersion: uatVersion ?? {}, | ||
prodVersion: prodVersion ?? {}, | ||
)); | ||
|
||
void addRepo(repoName, version) { | ||
state.repoVersion.update(repoName, (value) => version, ifAbsent: () => version); | ||
return emit(state.copyWith(repoVersion: state.repoVersion)); | ||
} | ||
|
||
|
||
void addDev(repoName, version) { | ||
state.devVersion.update(repoName, (value) => version, ifAbsent: () => version); | ||
return emit(state.copyWith(devVersion: state.devVersion)); | ||
} | ||
|
||
|
||
void addUat(repoName, version) { | ||
state.uatVersion.update(repoName, (value) => version, ifAbsent: () => version); | ||
return emit(state.copyWith(uatVersion: state.uatVersion)); | ||
} | ||
|
||
void addProd(repoName, version) { | ||
state.prodVersion.update(repoName, (value) => version, ifAbsent: () => version); | ||
return emit(state.copyWith(prodVersion: state.prodVersion)); | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
class AppState { | ||
Map<String, String> repoVersion; | ||
Map<String, String> devVersion; | ||
Map<String, String> uatVersion; | ||
Map<String, String> prodVersion; | ||
|
||
AppState({ | ||
required this.repoVersion, | ||
required this.devVersion, | ||
required this.uatVersion, | ||
required this.prodVersion, | ||
}); | ||
|
||
AppState copyWith({ | ||
Map<String, String>? repoVersion, | ||
Map<String, String>? devVersion, | ||
Map<String, String>? uatVersion, | ||
Map<String, String>? prodVersion, | ||
}) { | ||
return AppState( | ||
repoVersion: repoVersion ?? this.repoVersion, | ||
devVersion: devVersion ?? this.devVersion, | ||
uatVersion: uatVersion ?? this.uatVersion, | ||
prodVersion: prodVersion ?? this.prodVersion, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters