branch property

String? get branch

Extracts the first branch name from session's git repository outcomes.

Implementation

String? get branch {
  final gitOutcome = sessionContext.outcomes?.firstWhere(
    (_) => true,
    orElse: () => const GitRepositoryOutcome(repo: '', branches: []),
  );
  return (gitOutcome?.branches.isNotEmpty ?? false)
      ? gitOutcome!.branches.first
      : null;
}