PlatformRefImpl createPlatform(Injector injector)

Creates a platform. Platforms have to be eagerly created via this function.

Source

PlatformRefImpl createPlatform(Injector injector) {
  assert(() {
    if (_inPlatformCreate) {
      throw new BaseException('Already creating a platform...');
    }
    if (_platform != null && !_platform.disposed) {
      throw new BaseException('There can be only one platform. Destroy the '
          'previous one to create a new one.');
    }
    return true;
  });
  _inPlatformCreate = true;
  try {
    _platform = injector.get(PlatformRef);
    _platform.init(injector);
  } finally {
    _inPlatformCreate = false;
  }
  return _platform;
}