mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
new: setting of termCursor type
This commit is contained in:
12
lib/core/extension/enum.dart
Normal file
12
lib/core/extension/enum.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
extension EnumListX<T> on List<T> {
|
||||
T fromIndex(int index, [T? defaultValue]) {
|
||||
try {
|
||||
return this[index];
|
||||
} catch (e) {
|
||||
if (defaultValue != null) {
|
||||
return defaultValue;
|
||||
}
|
||||
throw Exception('Invalid index: $index');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user