dispose method

  1. @override
Future<void> dispose()
override

Disposes the Android view.

The AndroidViewController object is unusable after calling this. The identifier of the platform view cannot be reused after the view is disposed.

Implementation

@override
Future<void> dispose() async {
  final _AndroidViewState state = _state;
  _state = _AndroidViewState.disposed;
  _platformViewCreatedCallbacks.clear();
  PlatformViewsService._instance._focusCallbacks.remove(viewId);
  if (state == _AndroidViewState.creating || state == _AndroidViewState.created) {
    await _sendDisposeMessage();
  }
}