The wrapper library provides two functions for fetching lessons from a remote service.
Add the wrapper package to your pubspec.yaml:
dependencies:
unipi_orario_wrapper:
git:
url: https://github.com/your_repo/unipi_orario_wrapper.gitRun flutter pub get to install the dependencies.
import 'package:unipi_orario_wrapper/src/models/lesson.dart';
import 'package:unipi_orario_wrapper/src/service/wrapper_api_service.dart';The fetchLessons method retrieves a list of lessons as dynamic objects:
WrapperService wrapperService = WrapperService();
List<dynamic> lessons = await wrapperService.fetchLessons(
calendarId: 'your_calendar_id',
startDate: DateTime(2023, 09, 01),
endDate: DateTime(2023, 09, 07),
);
print(lessons);The fetchLessonsObj method retrieves lessons and converts them into Lesson objects:
WrapperService wrapperService = WrapperService();
List<Lesson> lessons = await wrapperService.fetchLessonsObj(
calendarId: 'your_calendar_id',
startDate: DateTime(2023, 09, 01),
endDate: DateTime(2023, 09, 07),
);
for (var lesson in lessons) {
print(lesson);
}