Prepare for making intl toBeginningOfSentenceCase non-nullable (#127488)

I intend to edit `toBeginningOfSentenceCase`'s return value to be non-nullable because it really is never null. That will mean that non-null asserts around it will become flagged as unnecessary, although right now they are necessary. So, apply a workaround - instead use a function that does a non-null assert without triggering any lints even after it becomes unnecessary.
This commit is contained in:
Oleh Prypin 2023-06-23 05:25:45 +02:00 committed by GitHub
parent 34b42acf1b
commit 71228e02c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,7 +59,8 @@ String sentenceCase(String str, [String? locale]) {
if (str.isEmpty) {
return str;
}
return toBeginningOfSentenceCase(str, locale)!;
// TODO(christopherfujino): Remove this check after the next release of intl
return ArgumentError.checkNotNull(toBeginningOfSentenceCase(str, locale));
}
/// Converts `foo_bar` to `Foo Bar`.