copilot suggestions

This commit is contained in:
ggurdin 2025-11-04 16:13:24 -05:00
parent a48a799af7
commit 26c8728114
No known key found for this signature in database
GPG key ID: A01CB41737CBB478
3 changed files with 21 additions and 7 deletions

View file

@ -117,11 +117,15 @@ class IGCTextState {
) {
final openMatch = _openMatches.firstWhere(
(m) => m.originalMatch == match.originalMatch,
orElse: () => throw "No open match found for acceptReplacement",
orElse: () => throw Exception(
'No open match found for acceptReplacement',
),
);
if (match.updatedMatch.match.selectedChoice == null) {
throw "acceptReplacement called with null selectedChoice";
throw Exception(
'acceptReplacement called with null selectedChoice',
);
}
match.setStatus(status);
@ -140,7 +144,9 @@ class IGCTextState {
PangeaMatch ignoreReplacement(PangeaMatchState match) {
final openMatch = _openMatches.firstWhere(
(m) => m.originalMatch == match.originalMatch,
orElse: () => throw "No open match found for ignoreReplacement",
orElse: () => throw Exception(
'No open match found for ignoreReplacement',
),
);
match.setStatus(PangeaMatchStatus.ignored);
@ -152,7 +158,9 @@ class IGCTextState {
void undoReplacement(PangeaMatchState match) {
final closedMatch = _closedMatches.firstWhere(
(m) => m.originalMatch == match.originalMatch,
orElse: () => throw "No closed match found for undoReplacement",
orElse: () => throw Exception(
'No closed match found for undoReplacement',
),
);
_closedMatches.remove(closedMatch);
@ -160,7 +168,9 @@ class IGCTextState {
final choice = match.updatedMatch.match.selectedChoice?.value;
if (choice == null) {
throw "match.match.selectedChoice is null in undoReplacement";
throw Exception(
"match.match.selectedChoice is null in undoReplacement",
);
}
final String replacement = match.originalMatch.match.fullText.characters

View file

@ -53,7 +53,9 @@ class ContextualDefinitionRepo {
);
if (res.statusCode != 200) {
throw res;
throw Exception(
"Contextual definition request failed with status code ${res.statusCode}",
);
}
final ContextualDefinitionResponseModel response =

View file

@ -153,7 +153,9 @@ class ChoiceItem extends StatelessWidget {
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
),
),
onLongPress: () => onLongPress!(entry.value.text, entry.key),
onLongPress: onLongPress != null
? () => onLongPress!(entry.value.text, entry.key)
: null,
onPressed: () => onPressed(entry.value.text, entry.key),
child: Text(
getDisplayCopy != null