There is no api for maui can detect if the physical keyboard is connected. But you can call the platform native code to do that.
bool isphysicakeyboardconnected;#if ANDROID isphysicakeyboardconnected = Platform.CurrentActivity.Resources.Configuration.Keyboard != Android.Content.Res.KeyboardType.Nokeys;#elif IOS isphysicakeyboardconnected = GameController.GCKeyboard.CoalescedKeyboard !=null;#endif