randomUserAgent function

String randomUserAgent(
  1. UserAgentDevice type
)

Implementation

String randomUserAgent(UserAgentDevice type) {
  switch (type) {
    case UserAgentDevice.mobile:
      return _randomMobileUA();
    case UserAgentDevice.desktop:
      return _randomDesktopUA();
    case UserAgentDevice.random:
      return _oneOf([
        _windowsDesktopUA(),
        _macDesktopUA(),
        _linuxDesktopUA(),
        _androidMobileUA(),
        _iPhoneSafariUA()
      ]);
    case UserAgentDevice.android:
      return _androidMobileUA();
    case UserAgentDevice.ios:
      return _iPhoneSafariUA();
    case UserAgentDevice.windows:
      return _windowsDesktopUA();
    case UserAgentDevice.linux:
      return _linuxDesktopUA();
    case UserAgentDevice.mac:
      return _macDesktopUA();
  }
}