updateSegment method

Future<void> updateSegment(
  1. int pageId,
  2. int position,
  3. Segment segment
)

Updates the given segment at the given position

Implementation

Future<void> updateSegment(int pageId, int position, Segment segment) async {
  final data = segment.toJson();
  if (segment.file != null) {
    data['file'] = segment.file!.id;
  } else if (segment.gallery != null) {
    data['gallery'] = segment.gallery!.id;
  }

  await _put('/api/segment-page/$pageId/segment/$position', data: data);
}