How can I disable some functionality only if web on Flutter app?


I see that up today flutter has a beta web support. But if I have some view or in general some functionality that support only mobile devices, how can disable it only when I build for the web? is it possible ?


import 'package:flutter/foundation.dart';

if (kIsWeb) {
  // running on the web!
} else {
  // NOT running on the web! You can check for additional platforms here.

Also if you want to check for inside widget and not show mobile widget

child: kIsWeb ? Container():<Mobile Widget>

Answered By – Dev

Answer Checked By – Candace Johnson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.