Update request_body.dart

This commit is contained in:
Ashita Prasad
2024-09-16 16:52:25 +05:30
parent edf8c523c8
commit 31c84da762

View File

@ -18,21 +18,16 @@ class EditRequestBody extends ConsumerWidget {
final contentType = ref.watch(selectedRequestModelProvider final contentType = ref.watch(selectedRequestModelProvider
.select((value) => value?.httpRequestModel?.bodyContentType)); .select((value) => value?.httpRequestModel?.bodyContentType));
final sm = ScaffoldMessenger.of(context);
void changeToPostMethod() { void changeToPostMethod() {
RequestModel? model = ref if (requestModel?.httpRequestModel!.method == HTTPVerb.get) {
.read(collectionStateNotifierProvider.notifier)
.getRequestModel(selectedId);
if (model!.httpRequestModel!.method == HTTPVerb.get) {
ref ref
.read(collectionStateNotifierProvider.notifier) .read(collectionStateNotifierProvider.notifier)
.update(selectedId, method: HTTPVerb.post); .update(selectedId, method: HTTPVerb.post);
ScaffoldMessenger.of(context).showSnackBar(const SnackBar( sm.hideCurrentSnackBar();
content: Text( sm.showSnackBar(getSnackBar(
"Switched to POST method", "Switched to POST method",
style: TextStyle(color: Colors.white), small: false,
),
backgroundColor: Colors.black,
)); ));
} }
} }