updateCourse method

  1. @override
Future<MoodleCourse> updateCourse(
  1. String token,
  2. MoodleCourse course
)
override

Updates the data for a given course and returns the updated course confirmed by the server.

Implementation

@override
Future<MoodleCourse> updateCourse(String token, MoodleCourse course) async {
  try {
    await _apiService.callFunction(
      token: token,
      function: 'local_lbplanner_courses_update_course',
      body: course.toJson()..remove('name'),
    );

    return course;
  } catch (e, s) {
    log('Failed to update course', e, s);
    rethrow;
  }
}