feat(remote): add ability to pass callbacks as arguments

This commit is contained in:
Aleksey Kulikov 2021-09-28 17:17:03 +03:00
parent b15b56f0ae
commit 299d1a17e7
8 changed files with 374 additions and 68 deletions

25
lib/src/callbacks.dart Normal file
View file

@ -0,0 +1,25 @@
import 'oid.dart';
import 'remote.dart';
class Callbacks {
const Callbacks({
this.transferProgress,
this.sidebandProgress,
this.updateTips,
this.pushUpdateReference,
});
/// Callback function that reports transfer progress.
final void Function(TransferProgress)? transferProgress;
/// Callback function that reports textual progress from the remote.
final void Function(String)? sidebandProgress;
/// Callback function matching the `void Function(String refname, Oid old, Oid new)`
/// that report reference updates.
final void Function(String, Oid, Oid)? updateTips;
/// Callback function matching the `void Function(String refname, String message)`
/// used to inform of the update status from the remote.
final void Function(String, String)? pushUpdateReference;
}