Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DartError: Unsupported operation: Platform._operatingSystem #547

Open
mulin-xml opened this issue Dec 19, 2024 · 8 comments
Open

DartError: Unsupported operation: Platform._operatingSystem #547

mulin-xml opened this issue Dec 19, 2024 · 8 comments

Comments

@mulin-xml
Copy link

Web platform, version 8.2.10

@Rezki-Pratama
Copy link

I suspect the error might be caused by the dart:io package being called on the web platform, where it is not supported.

import 'dart:io';
......
......
......
if (backgroundColor == null && Platform.isIOS) {
  backgroundColor = Colors.black;
}
if (textColor == null && Platform.isIOS) {
  textColor = Colors.white;
}
....
....

@vijayvaghela72
Copy link

i am facing same issue in flutter web

@vijayvaghela72
Copy link

even i am not using dart:io package

@vijayvaghela72
Copy link

DartError: Unsupported operation: Platform._operatingSystem

import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'package:fluttertoast/fluttertoast.dart';

setSnackbar(String msg) {
if (kIsWeb) {
try {
Fluttertoast.showToast(
msg: msg,
webBgColor: "linear-gradient(to right, #231D1E, #231D1E)",
fontSize: 14,
textColor: Colors.orange,
);
} catch (e) {
print('Error in snackbar: $e ');
}
} else {
Fluttertoast.showToast(
msg: msg,
fontSize: 14,
);
}
}

@Rezki-Pratama
Copy link

even i am not using dart:io package

I mean on this source code
https://github.com/ponnamkarthik/FlutterToast/blob/master/lib/fluttertoast.dart

@vijayvaghela72
Copy link

vijayvaghela72 commented Dec 30, 2024

even i am not using dart:io package

I mean on this source code https://github.com/ponnamkarthik/FlutterToast/blob/master/lib/fluttertoast.dart

yes exactly ,

facing issue only for flutter web.

in android and iOS working fine

@vijayvaghela72
Copy link

if there is any update regarding this please inform me @Rezki-Pratama .

@harikrushn1412
Copy link

Please remove the ^ from the dependency version, run pub get again, and use version 8.2.2 of the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants