Skip to content

Commit 665fdaf

Browse files
author
Casey Hillers
authored
Make CheckRunConclusion nullable (#276)
1 parent c72b460 commit 665fdaf

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 8.2.4
2+
- Make CheckRunConclusion nullable
3+
14
## 8.2.3
25
- Added `generateReleaseNotes` boolean to CreateRelase class to have github auto-create release notes
36
- Added `generateReleaseNotes` method to RepositoriesService to have github create release notes

lib/src/common/model/checks.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@ class CheckRunConclusion extends EnumWithValue {
4545
static const cancelled = CheckRunConclusion._('cancelled');
4646
static const timedOut = CheckRunConclusion._('timed_out');
4747
static const actionRequired = CheckRunConclusion._('action_required');
48+
static const empty = CheckRunConclusion._(null);
4849

49-
const CheckRunConclusion._(String value) : super(value);
50+
const CheckRunConclusion._(String? value) : super(value);
5051

5152
factory CheckRunConclusion._fromValue(String? value) {
53+
if (value == null) {
54+
return empty;
55+
}
5256
for (final level in const [
5357
success,
5458
failure,

lib/src/common/util/utils.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import 'package:meta/meta.dart';
55
/// but with a String value that is used for serialization.
66
@immutable
77
abstract class EnumWithValue {
8-
final String value;
8+
final String? value;
99

1010
/// The value will be used when [toJson] or [toString] will be called.
1111
/// It will also be used to check if two [EnumWithValue] are equal.
1212
const EnumWithValue(this.value);
1313

1414
@override
15-
String toString() => value;
15+
String toString() => value ?? 'null';
1616

1717
/// Returns the String value of this.
18-
String toJson() => value;
18+
String toJson() => value ?? 'null';
1919

2020
/// True iff [other] is an [EnumWithValue] with the same value as this object.
2121
@override

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: github
2-
version: 8.2.3
2+
version: 8.2.4
33
description: A high-level GitHub API Client Library that uses Github's v3 API
44
homepage: https://github.com/SpinlockLabs/github.dart
55

0 commit comments

Comments
 (0)