Skip to content

Commit 9fdabe5

Browse files
committed
Add trExists to context extension
1 parent 1d1251a commit 9fdabe5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/src/public_ext.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,16 @@ extension BuildContextEasyLocalizationExtension on BuildContext {
219219
);
220220
}
221221

222+
bool trExists(String key) {
223+
final localization = Localization.of(this);
224+
225+
if (localization == null) {
226+
throw const LocalizationNotFoundException();
227+
}
228+
229+
return localization.exists(key);
230+
}
231+
222232
String plural(
223233
String key,
224234
num number, {

0 commit comments

Comments
 (0)