Flutter import dart:ffi not found - flutter

I am trying to use flutter_js in order to run a javascript on web-browser (desktop, not mobile). When I run the app i get /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_js-0.6.0/lib/javascript_runtime.dart:3:8: Error: Not found: 'dart:ffi' import 'dart:ffi';
Is there something that I do wrong or is it from the library?
If i run it on windows app, it works.

I think you're using dart:ffi somewhere. But this library is used to access native code and it won't fork on web. I'd suggest you to search for the place when you're importing dart:ffi and handle this with a conditional import.
UPD:
Maybe you have dart:ffi package somewhere in a project recources. That can be a reason of error also.

Related

By updating Flutter 3.8.0 Error in flutter_date_time_picker

By updating Flutter 3.8.0
I am getting the following error in flutter_date_time_picker.
I would like to know if anyone knows a solution to this problem.
../../../../.pub-cache/git/flutter_datetime_picker-eb66486c47d50bf550950c196486121ffcea8885/lib/flutter_datetime_picker.dart:7:1: Error:
'DatePickerTheme' is imported from both 'package:flutter/src/material/date_picker_theme.dart' and'package:flutter_datetime_picker/src/datetime_picker_theme.dart'.
pubspeck.yaml
flutter_datetime_picker:
git:
url: https://github.com/Realank/flutter_datetime_picker.git
If anyone knows of a solution, I would love to hear about it.
I believe this is probably due to the flutter update, as I was able to build normally until yesterday!
If anyone knows of a solution, I would love to hear about it.
You can try the following steps:
Remove the flutter_datetime_picker package from your pubspec.yaml file.
Run flutter clean in your terminal to remove any cached files.
Re-install the flutter_datetime_picker package.
first try to flutter clean and then pub get and reinstall the package you want. if again you had this error try this:
To resolve it; in the class where you have both imports, assign an alias to one of the packages using the as keyword.
import 'package:flutter/src/material/date_picker_theme.dart' as dp
dp.EveryMethodYouWant(); //call the class using the alias
if you had any question i'm here.
happy coding.
By mistakenly,you have imported the wrong package because as per the package documentation, there is no such line mentioned.
Import the package mentioned below and try pub get.
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
everything vill works fine.

SwiftUI: No such Module 'FirebaseAuth'

I've run into a strange issue when trying to setup Firebase sign in with Apple functionality in my app.
It is required to import FirebaseAuth for OAuth functionality. When I try importing it I get the error : "No such Module 'FirebaseAuth'". I have added the package dependencies with package manager and FirebaseAuth is there... but it still gives the error. See screenshot below.
Simply importing Firebase does not give an import error, however I still get errors when trying to use the Authentication functionality. See screenshot below
I've looked for solutions elsewhere but others who have had the same issue as me used Cocoapods to install the packages so their solutions don't apply here.
I am using Xcode 13.0
I fixed the issue by adding FirebaseAuth dependency in build phases:

How to compile the source code based on the platform in Flutter?

I have implemented a plugin in Flutter. And it is running good with android and ios. Later added web platform support. It also working good in web version. After adding web platform support, I tried to execute the mobile version android from android studio.
Code is not compiling and giving the below error messages.
/lib/native_video_view_web.dart:5:8: Error: Not found: 'dart:html'
import 'dart:html';
^
/lib/src/navigation/js_url_strategy.dart:9:8: Error: Not found: 'dart:html'
import 'dart:html' as html;
I understood this is due to 'dart:html' package, which is ONLY available for web and NOT for the mobile version. Here is some discussion about the same Reference Link. Nobody mentioned how to compile the code based on the platform to avoid this issue.
Later I have observed, video_player flutter plugin source code. They are also supporting web version. And noticed that they are also using 'dart:html' in their web implementation. And i tried to execute mobile and web build. All are working fine with any problem. I am not understanding how they have managed to compiled code based on the platform. So 'dart:html' will not create problem for mobile builds.
Does anybody have any idea, how to deal with this issue.

cannot import path_provider package

I'm building new flutter app, I've downloaded the last version of path_provider package, but when I try to import it using the import statement form the docs
import 'package:path_provider/path_provider.dart';
It didn't work, it says this package doesn't exist, instead I can import things like
import 'package:path_provider_linux/path_provider_linux.dart';
which doens't have the functionality I want.
Can you build the application?
Are you deploying to mobile or MacOS?
Try to run a fresh release configuration, and if it works, then reboot your IDE.
Then run the command that Confidence Yobo suggested, to redownload the packages via yaml.
Also make sure that your yaml file is formatted correctly. Once a pubspec GET command has finished running and the lock is released, normally if there is an error it will show up on your output window.
Also make sure to get the latest package: path_provider: ^1.6.18

Flutter run says '...dependencies could not be established' for the meterial.dart library

I am new to flutter.io and trying to create my first flutter app according to the following guide
https://codelabs.developers.google.com/codelabs/first-flutter-app-pt1/#2
I used terminal command flutter run to start my application and then found an error as follows.
Your application could not be compiled, because its dependencies could not be established.
The following Dart file:
./startup_namer/lib/main.dart
...refers, in an import, to the following library:
/opt/flutter/packages/flutter/lib/meterial.dart
Unfortunately, that library does not appear to exist on your file system.
Couldn't find more details on how to resolve this issue.I am gussing that i should install this library package within my setup.What is the easiest method to install flutter library package from terminal?
Note: i created the app using command flutter create startup_namer
Judging by the error message you have mis-spelled the package in the import statements meterial.dart
It should be:
import 'package:flutter/material.dart';
Note: You may run into same error if you were to change the variable "name: myapp" in your pubspec.yaml file with "import 'package:myapp/settings.dart';" as the custom package in the main.dart file as was intended to add "comanyName" text to the app launcher icons. Fix: changed back to "name: myapp" removed the error