setSize method

Future<void> setSize (Size size)

Sizes the Android View.

size is the view's new size in logical pixel, it must not be null and must be bigger than zero.

The first time a size is set triggers the creation of the Android view.

Implementation

Future<void> setSize(Size size) async {
  assert(_state != _AndroidViewState.disposed, 'trying to size a disposed Android View. View id: $id');

  assert(size != null);
  assert(!size.isEmpty);

  if (_state == _AndroidViewState.waitingForSize)
    return _create(size);

  await SystemChannels.platform_views.invokeMethod('resize', <String, dynamic> {
    'id': id,
    'width': size.width,
    'height': size.height,
  });
}