From 5401717713c17457f60e5c955b131e3a41b95c19 Mon Sep 17 00:00:00 2001 From: Aleksey Kulikov Date: Mon, 27 Sep 2021 11:23:38 +0300 Subject: [PATCH] refactor(stash): reset stash list at the end of the method --- lib/src/bindings/stash.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/src/bindings/stash.dart b/lib/src/bindings/stash.dart index fb72979..e98b534 100644 --- a/lib/src/bindings/stash.dart +++ b/lib/src/bindings/stash.dart @@ -128,10 +128,13 @@ var _stashList = []; /// Loop over all the stashed states. List list(Pointer repo) { const except = -1; - _stashList.clear(); git_stash_cb callBack = Pointer.fromFunction(_stashCb, except); libgit2.git_stash_foreach(repo, callBack, nullptr); - return _stashList; + + final result = _stashList.toList(growable: false); + _stashList.clear(); + + return result; } int _stashCb(