Minor updates

This commit is contained in:
Ankit Mahato
2023-03-08 23:45:03 +05:30
parent 618a9f126f
commit c99bd771b9
4 changed files with 10 additions and 5 deletions

1
.gitignore vendored
View File

@ -49,3 +49,4 @@ linux/
macos/
windows/
web/
.vscode/settings.json

View File

@ -28,7 +28,7 @@ class _RequestEditorPaneState extends ConsumerState<RequestEditorPane> {
return Padding(
padding: const EdgeInsets.all(8),
child: Column(
children: [
children: const [
EditorPaneRequestURLCard(),
SizedBox(
height: 10,

View File

@ -150,7 +150,7 @@ class _URLTextFieldState extends ConsumerState<URLTextField> {
key: Key("url-${activeId!}"),
initialValue: ref
.read(collectionStateNotifierProvider.notifier)
.getRequestModel(activeId!)
.getRequestModel(activeId)
.url,
style: codeStyle,
decoration: InputDecoration(
@ -161,7 +161,7 @@ class _URLTextFieldState extends ConsumerState<URLTextField> {
onChanged: (value) {
ref
.read(collectionStateNotifierProvider.notifier)
.update(activeId!, url: value);
.update(activeId, url: value);
},
);
}

View File

@ -20,6 +20,8 @@ class CollectionStateNotifier extends StateNotifier<List<RequestModel>> {
),
]);
final baseResponseModel = const ResponseModel();
int idxOfId(String id) => state.indexWhere((element) => element.id == id);
RequestModel getRequestModel(String id) {
@ -95,8 +97,10 @@ class CollectionStateNotifier extends StateNotifier<List<RequestModel>> {
message: responseRec.$2,
);
} else {
final responseModel = ResponseModel()
.fromResponse(response: responseRec.$0!, time: responseRec.$1!);
final responseModel = baseResponseModel.fromResponse(
response: responseRec.$0!,
time: responseRec.$1!,
);
int statusCode = responseRec.$0!.statusCode;
newRequestModel = requestModel.copyWith(
responseStatus: statusCode,