mirror of
https://github.com/foss42/apidash.git
synced 2025-06-03 00:14:06 +08:00
Update providers
This commit is contained in:
@ -69,6 +69,22 @@ class CollectionStateNotifier
|
||||
ref.read(hasUnsavedChangesProvider.notifier).state = true;
|
||||
}
|
||||
|
||||
void addRequestModel(HttpRequestModel httpRequestModel) {
|
||||
final id = getNewUuid();
|
||||
final newRequestModel = RequestModel(
|
||||
id: id,
|
||||
httpRequestModel: httpRequestModel,
|
||||
);
|
||||
var map = {...state!};
|
||||
map[id] = newRequestModel;
|
||||
state = map;
|
||||
ref
|
||||
.read(requestSequenceProvider.notifier)
|
||||
.update((state) => [id, ...state]);
|
||||
ref.read(selectedIdStateProvider.notifier).state = newRequestModel.id;
|
||||
ref.read(hasUnsavedChangesProvider.notifier).state = true;
|
||||
}
|
||||
|
||||
void reorder(int oldIdx, int newIdx) {
|
||||
var itemIds = ref.read(requestSequenceProvider);
|
||||
final itemId = itemIds.removeAt(oldIdx);
|
||||
|
Reference in New Issue
Block a user