style: move declarations of callbacks above the function they will be used in

This commit is contained in:
Aleksey Kulikov 2021-10-07 13:52:46 +03:00
parent a1d617e053
commit 5be0d0a6b5
2 changed files with 24 additions and 22 deletions

View file

@ -139,18 +139,6 @@ void pop({
/// IMPORTANT: make sure to clear that list since it's a global variable.
var _stashList = <Stash>[];
/// Loop over all the stashed states.
List<Stash> list(Pointer<git_repository> repo) {
const except = -1;
git_stash_cb callBack = Pointer.fromFunction(_stashCb, except);
libgit2.git_stash_foreach(repo, callBack, nullptr);
final result = _stashList.toList(growable: false);
_stashList.clear();
return result;
}
/// A callback function to iterate over all the stashed states.
int _stashCb(
int index,
@ -165,3 +153,15 @@ int _stashCb(
));
return 0;
}
/// Loop over all the stashed states.
List<Stash> list(Pointer<git_repository> repo) {
const except = -1;
git_stash_cb callBack = Pointer.fromFunction(_stashCb, except);
libgit2.git_stash_foreach(repo, callBack, nullptr);
final result = _stashList.toList(growable: false);
_stashList.clear();
return result;
}