Getting errors when intl is imported - dart

When i add intl: ^0.17.0 to pubspec.yaml
i get the following errors:
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.17.0/lib/intl_browser.dart:12:8: Error: Not found: 'dart:html'
import 'dart:html';
^
../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.17.0/lib/intl_browser.dart:24:48: Error: Undefined name 'window'.
Intl.systemLocale = Intl.canonicalizedLocale(window.navigator.language);
^^^^^^
This only happens when the intl package is added.
How can i fix this?

The problem was that i had imported: package:intl/intl_browser.dart
instead of: package:intl/intl.dart

Related

Xcode: command line error error: no such module 'XCTest'

I'm trying implement unit test in some of my Swift Scripts but I'm getting this error:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/XCTest.swiftmodule/x86_64.swiftinterface:6:19: error: no such module 'XCTest'
#_exported import XCTest
^
one.swift:3:8: error: failed to load module 'XCTest'
import XCTest
^
This is my script:
#!/usr/bin/swift
import Foundation
import XCTest
print("my script")
Any of you knows why I'm getting this error and if there is a work around this error?
I'll really appreciate your help.

Expo 34: Error Undefined is not an object on _expo.Constants.deviceId

I received below message after upgrade my expo project from sdk 33 to 34. I have no idea where this issue is from. Does anyone have this error before.
install expo-constants package
change import to
import Constants from 'expo-constants';
you can use Constants.installationId and not deviceId.

Error after add simple_permission or permission_handler on flutter

I want to create a folder to try downloading files. so I added simple_permission but I got an error migrating to androidX even though I migrated to androidX. how can I resolve this error?
Launching lib\main.dart on Coolpad E502 in debug mode...
D:\Flutter\flutter.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:9: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
^
symbol: class ActivityCompat
location: package android.support.v4.app
D:\Flutter\flutter.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:10: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
^
D:\Flutter\flutter.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:156: error: cannot find symbol
ActivityCompat.requestPermissions(activity, perm, 0);
^
symbol: variable ActivityCompat
location: class SimplePermissionsPlugin
D:\Flutter\flutter.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:163: error: cannot find symbol
return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(activity, permission);
^
symbol: variable ContextCompat
location: class SimplePermissionsPlugin
D:\Flutter\flutter.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:171: error: cannot find symbol
if (ActivityCompat.shouldShowRequestPermissionRationale(registrar.activity(), permission)) {
^
symbol: variable ActivityCompat
location: class SimplePermissionsPlugin
D:\Flutter\flutter.pub-cache\hosted\pub.dartlang.org\simple_permissions-0.1.9\android\src\main\java\com\ethras\simplepermissions\SimplePermissionsPlugin.java:175: error: cannot find symbol
if (ActivityCompat.checkSelfPermission(registrar.context(), permission) == PackageManager.PERMISSION_GRANTED) {
^
symbol: variable ActivityCompat
location: class SimplePermissionsPlugin
6 errors
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':simple_permissions:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 45s
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.\
Exited (sigterm)
I had the same error and what I did was change the version of klotin in the build.gradle file I have it as follows
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
}
}

SASS not compiling with the Dart DDC

I am getting the following errors when compiling my web-app with DDC:
SEVERE] build_web_compilers|ddc on package:sass/sass.dartdevc.module (cached):
Error compiling dartdevc module:sass|lib/sass.ddc.js
[error] Target of URI doesn't exist: 'node/interface.dart'. (package:sass/src/importer/node.dart, line 5, col 8)
[error] The exported library ''node/interface.dart'' can't have a part-of directive. (package:sass/src/importer/node.dart, line 5, col 8)
[error] Target of URI doesn't exist: 'io/interface.dart'. (package:sass/src/io.dart, line 7, col 8)
[error] Target of URI doesn't exist: 'io/interface.dart'. (package:sass/src/io.dart, line 12, col 8)
[error] The exported library ''io/interface.dart'' can't have a part-of directive. (package:sass/src/io.dart, line 12, col 8)
[error] Target of URI doesn't exist: 'package:package_resolver/package_resolver.dart'. (package:sass/src/sync_package_resolver.dart, line 1, col 8)
Im not really sure what I need. I have a dart file named compiler-sass.dart with the following code:
import 'dart:io';
import 'package:sass/sass.dart' as sass;
void main(List<String> arguments) {
var result = sass.compile(arguments[0]);
new File(arguments[1]).writeAsStringSync(result);
}
If I manually compile my sass files it works but not with the command:
webdev serve --hot-reload
My pubspec has the following dependencies:
dependencies:
path: ^1.4.1
sass: ^1.16.1
vue: ^0.4.1
build_runner: ^1.1.2
build_web_compilers: ^1.0.0
intl: ^0.15.7
What am I missing here? Why doesnt it work?
https://pub.dartlang.org/packages/sass_builder integrates directly with webdev to incrementally only build what changed and what the browser fetches.

OpenCV ImportError using python

I'm trying to work with OpenCV3 in Python 3.5. I installed it but when I call
import cv2
I get this error message:
ImportError: /usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3: undefined
symbol:
_ZNK6google8protobuf11MessageLite25InitializationErrorStringB5cxx11Ev
Anybody ever had this error? Thanks.

Resources