// Automatic FlutterFlow imports
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/actions/index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
import 'dart:html';
Future<bool> getMobileOperatingSystem() async {
// check android or ios, on web browser (website). it's a website check on web if it's android or ios
// Check if the user agent string contains "Android" or "iOS"
final userAgent = window.navigator.userAgent;
if (userAgent.contains('Android')) {
return false;
} else if (userAgent.contains('iPhone') ||
userAgent.contains('iPad') ||
userAgent.contains('iPod')) {
return true;
} else {
return false;
}
}
An action function to detect if device is iOS or Android on a (web browser) #sharing_is_caring
General Conversations
8
4 replies