diff --git a/.gitignore b/.gitignore index db15a9c5..0b6d0c9e 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ linux/ macos/ windows/ web/ +.vscode/settings.json diff --git a/lib/components/editor_pane.dart b/lib/components/editor_pane.dart index a3302fa1..5b340e9f 100644 --- a/lib/components/editor_pane.dart +++ b/lib/components/editor_pane.dart @@ -28,7 +28,7 @@ class _RequestEditorPaneState extends ConsumerState { return Padding( padding: const EdgeInsets.all(8), child: Column( - children: [ + children: const [ EditorPaneRequestURLCard(), SizedBox( height: 10, diff --git a/lib/components/editor_pane/url_card.dart b/lib/components/editor_pane/url_card.dart index 4e07bccf..c7adb69b 100644 --- a/lib/components/editor_pane/url_card.dart +++ b/lib/components/editor_pane/url_card.dart @@ -150,7 +150,7 @@ class _URLTextFieldState extends ConsumerState { 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 { onChanged: (value) { ref .read(collectionStateNotifierProvider.notifier) - .update(activeId!, url: value); + .update(activeId, url: value); }, ); } diff --git a/lib/providers/providers.dart b/lib/providers/providers.dart index d90b1c5b..fef785e0 100644 --- a/lib/providers/providers.dart +++ b/lib/providers/providers.dart @@ -20,6 +20,8 @@ class CollectionStateNotifier extends StateNotifier> { ), ]); + 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> { 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,