setLayoutDirection method Null safety
- TextDirection layoutDirection
Sets the layout direction for the Android view.
Implementation
Future<void> setLayoutDirection(TextDirection layoutDirection) async {
assert(
_state != _AndroidViewState.disposed,
'trying to set a layout direction for a disposed UIView. View id: $viewId',
);
if (layoutDirection == _layoutDirection) {
return;
}
assert(layoutDirection != null);
_layoutDirection = layoutDirection;
// If the view was not yet created we just update _layoutDirection and return, as the new
// direction will be used in _create.
if (_state == _AndroidViewState.waitingForSize) {
return;
}
await SystemChannels.platform_views
.invokeMethod<void>('setDirection', <String, dynamic>{
'id': viewId,
'direction': _getAndroidDirection(layoutDirection),
});
}