mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
style: use "map/where" instead of "for" loop
This commit is contained in:
parent
3a0fa75929
commit
cfa5268af2
28 changed files with 193 additions and 323 deletions
|
@ -82,15 +82,12 @@ class Note {
|
|||
/// Throws a [LibGit2Error] if error occured.
|
||||
static List<Note> list(Repository repo) {
|
||||
final notesPointers = bindings.list(repo.pointer);
|
||||
var result = <Note>[];
|
||||
for (var note in notesPointers) {
|
||||
result.add(Note(
|
||||
note['note'] as Pointer<git_note>,
|
||||
note['annotatedId'] as Pointer<git_oid>,
|
||||
));
|
||||
}
|
||||
|
||||
return result;
|
||||
return notesPointers
|
||||
.map((e) => Note(
|
||||
e['note'] as Pointer<git_note>,
|
||||
e['annotatedId'] as Pointer<git_oid>,
|
||||
))
|
||||
.toList();
|
||||
}
|
||||
|
||||
/// Returns the note object's [Oid].
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue