myStories method

Future<List<Story>> myStories([
  1. String? lastId
])

Fetches a list of stories where id is smaller the given lastId.

Implementation

Future<List<Story>> myStories([String? lastId]) async {
  return ApiFactory.handleApiError(() async {
    final response = await _dio.get("/v1/api/story/mystories",
        queryParameters: lastId == null ? {} : {"last_id": lastId});
    final data = response.data;
    if (data is List) {
      return data.map((entry) => Story.fromJson(entry)).toList();
    }
    throw KakaoClientException("Stories response is not a json array.");
  });
}