fetchPinnedRepositories method
Implementation
Future<List<Repository>> fetchPinnedRepositories(String username) async {
final url = Uri.parse('https://api.github.com/users/$username/repos');
final response = await client.get(url);
if (response.statusCode == 200) {
final List<dynamic> repos = json.decode(response.body);
// Filter repositories based on a pinned criterion (e.g., pinned attribute)
return repos
.map((repo) => Repository.fromJson(repo))
.where((repo) => repo.isPinned) // Assuming `isPinned` is a property
.toList();
} else {
throw Exception('Failed to load repositories');
}
}