feat(reference): add ability to peel reference until object of specified type is found

This commit is contained in:
Aleksey Kulikov 2021-09-04 14:50:34 +03:00
parent 56713da648
commit f63808b4f8
4 changed files with 91 additions and 0 deletions

View file

@ -81,6 +81,13 @@ class Tag {
///
/// Returned object should be explicitly downcasted to one of four of git object types.
///
/// ```dart
/// final commit = tag.target as Commit;
/// final tree = tag.target as Tree;
/// final blob = tag.target as Blob;
/// final tag = tag.target as Tag;
/// ```
///
/// Throws a [LibGit2Error] if error occured.
Object get target {
final type = bindings.targetType(_tagPointer);