1
votes

I am converting a very basic Flutter mobile project to Flutter_web. I have it running just with the demo screen just fine.

I want to be able to produce a different layout in the browser if I'm running on MacOS/Windows vs Android/IOS.

When I run this project in a browser, the Platform code returns 'android'. I'm using Google Chrome.

I have tried utilizing the Platform library to decipher the currently running OS.

import 'package:flutter_web/io.dart

print("PLATFORM: ${Platform.operatingSystem}");
//This just produces 'android' which is obviously not right


if(Platform.Android || Platform.isIOS){
 return Widget();
} else {
 return null;
}

I'd like to get an accurate depiction of which Platform I'm running on. Any thoughts? THANK YOU!

1

1 Answers

0
votes

you can use kIsWeb constant to check web platform, but I think OS information is not available.

something like that https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/rendering/view.dart#L273