Error: Unsupported operation: Platform._localeName - flutter

I am using dart.io package and trying to detect the current locate of the system using Platform.localeName like this
WidgetsFlutterBinding.ensureInitialized();
String defaultSystemLocale = Platform.localeName;
print('$defaultSystemLocale');
But when I run the app in Chrome (Web), I am getting this error
Error: Unsupported operation: Platform._localeName
at Object.throw_ [as throw] (http://localhost:62284/dart_sdk.js:5061:11)
at Function._localeName (http://localhost:62284/dart_sdk.js:54692:17)
at Function.localeName (http://localhost:62284/dart_sdk.js:54698:71)
at Function.get localeName [as localeName] (http://localhost:62284/dart_sdk.js:54574:27)
at main (http://localhost:62284/packages/testapp/main4.dart.lib.js:97:45)
Any idea why?

If you are getting Platform from dart:io, it is not supported on web (see this website). You can import it from universal_io instead.

Related

Unable to connect MongoDB with Flutter Web App

Unsupported operation: default Security Context getter at Object.throw_ [as throw] (http://localhost:51147/dart_sdk.js:5080:11)
at mongo_dart._ConnectionManager.new.open (http://localhost:51147/packages/mongo_dart/src/database/utils/split_hosts.dart.lib.js:11102:23)at open.throw ()

ERROR Error: Uncaught (in promise): EmptyError: no elements in sequence vendor-es2015.js:43770

I'm developing my Ionic/Angular app, and I'm running into the following error when I try to log in through back-end login api. Any ideas as to why? I googled it, but I could find any relevant info, the issue still remains. What causes this error?
vendor-es2015.js:43770 ERROR Error: Uncaught (in promise): EmptyError: no elements in sequence
at resolvePromise (polyfills-es2015.js:4147)
at resolvePromise (polyfills-es2015.js:4104)
at polyfills-es2015.js:4208
at ZoneDelegate.invokeTask (polyfills-es2015.js:3741)
at Object.onInvokeTask (vendor-es2015.js:73623)
at ZoneDelegate.invokeTask (polyfills-es2015.js:3740)
at Zone.runTask (polyfills-es2015.js:3518)
at drainMicroTaskQueue (polyfills-es2015.js:3909)
at ZoneTask.invokeTask [as invoke] (polyfills-es2015.js:3819)
at invokeTask (polyfills-es2015.js:4953)
Finally, I found the cause of the issue. It's due to an error code returned by a back-end api call. After getting rid of the error code, the login functions well.

ERROR TypeError: Object(...) is not a function at WebIntent.get [as ACTION_VIEW]

I am trying to integrate Google pay into my app using web intent plugin. After I completed the install I got the following error:
ERROR TypeError: Object(...) is not a function at WebIntent.get [as
ACTION_VIEW]
Click here for my error

facing issue while running protractor-cucumber framework

Sir, I am trying to run file using protractor cucumber framework by using
async and await concept it passes all my tests but it always gives error
regarding angular testability and I don't know why it gives such a type of
error, please read the code below once and help me to figure out where I am
wrong in this approach.
Please refer below my feature file :-
Please refer my pageobjects file as below :-
Please refer step-definition file as below:-
Please refer configuration file conf.ts as below :-
Please refer console logs as below:-
[12:31:48] I/launcher - Running 1 instances of WebDriver
[12:31:48] I/direct - Using ChromeDriver directly...
DevTools listening on ws://127.0.0.1:54978/devtools/browser/3cec07ae-0398-49b1-8fd9-36607b210799
...Menu 9 option reached
..
1 scenario (1 passed)
4 steps (4 passed)
0m00.034s
(node:2484) UnhandledPromiseRejectionWarning: Error: Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are undefined. This could be either because this is a
non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See http://git.io/v4gXM for details"
at runWaitForAngularScript.then (E:\Backup_work\Protractor projects\cucumber2_framework\node_modules\protractor\built\browser.js:463:23)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)Error
at ElementArrayFinder.applyAction_ (E:\Backup_work\Protractor projects\cucumber2_framework\node_modules\protractor\built\element.js:459:27)
at ElementArrayFinder.(anonymous function).args [as click] (E:\Backup_work\Protractor projects\cucumber2_framework\node_modules\protractor\built\element.js:91:29)
at ElementFinder.(anonymous function).args [as click] (E:\Backup_work\Protractor projects\cucumber2_framework\node_modules\protractor\built\element.js:831:22)
at homepageclass.clickEXWmenu (E:\Backup_work\Protractor projects\cucumber2_framework\pageobjects\menu9.PO.js:10:29)
at World.<anonymous> (E:\Backup_work\Protractor projects\cucumber2_framework\Stepdefinition\first.steps.js:22:20)
at Generator.next (<anonymous>)
at E:\Backup_work\Protractor projects\cucumber2_framework\Stepdefinition\first.steps.js:7:71
at new Promise (<anonymous>)
at __awaiter (E:\Backup_work\Protractor projects\cucumber2_framework\Stepdefinition\first.steps.js:3:12)
at World.<anonymous> (E:\Backup_work\Protractor projects\cucumber2_framework\Stepdefinition\first.steps.js:21:12)
(node:2484) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2484) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:2484) UnhandledPromiseRejectionWarning: Error: Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are undefined. This could be either because this is a
non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See https://github.com/angular/protractor/issues/2643 for details"
at runWaitForAngularScript.then (E:\Backup_work\Protractor projects\cucumber2_framework\node_modules\protractor\built\browser.js:463:23)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)Error
at ElementArrayFinder.applyAction_ (E:\Backup_work\Protractor projects\cucumber2_framework\node_modules\protractor\built\element.js:459:27)
at ElementArrayFinder.(anonymous function).args [as click] (E:\Backup_work\Protractor projects\cucumber2_framework\node_modules\protractor\built\element.js:91:29)
at ElementFinder.(anonymous function).args [as click] (E:\Backup_work\Protractor projects\cucumber2_framework\node_modules\protractor\built\element.js:831:22)
at homepageclass.clickmenu9 (E:\Backup_work\Protractor projects\cucumber2_framework\pageobjects\menu9.PO.js:13:26)
at World.<anonymous> (E:\Backup_work\Protractor projects\cucumber2_framework\Stepdefinition\first.steps.js:26:10)
(node:2484) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
[12:31:50] I/launcher - 0 instance(s) of WebDriver still running
[12:31:50] I/launcher - chrome #01 passed
Your first problem here is you are using await but the function you are using await on is not async.
public async clickEXWMenu(){
await this.EXWenquirymenu.click();
}
This is how it should be ^

Post Categories in default Keystone JS

I've been experimenting with Keystone CMS for the past week and I realised if you tagged your posts with categories that you've created in the post categories section, you'll get the following errors:
TypeError: Object #<Object> has no method 'each'
at Promise.<anonymous> (/Users/clippetmac/Sites/keystone/routes/views/blog.js:31:10)
at Promise.<anonymous> (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8)
at Promise.emit (events.js:95:17)
at Promise.emit (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:84:38)
at Promise.fulfill (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:97:20)
at Promise.resolve (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/lib/promise.js:108:23)
at Promise.<anonymous> (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8)
at Promise.emit (events.js:95:17)
at Promise.emit (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:84:38)
at Promise.fulfill (/Use rs/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:97:20)
at /Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/lib/query.js:1052:26
at model.Document.init (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/lib/document.js:250:11)
at completeMany (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/lib/query.js:1050:12)
at Object.cb (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/lib/query.js:1016:11)
at Object._onImmediate (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mquery/lib/utils.js:137:16)
at processImmediate [as _immediateCallback] (timers.js:336:15)
Any Idea why?
The main issue here is that the async object that I've initialised does not have an "each" method.It turns out that I'm using an old async library that I've downloaded months ago. I installed the latest version of async and it worked like a charm.