Unsupported operation in Flutter web just_audio library - flutter

I've debugged the issue and came to a problem in the audio_service.dart at line 969. In this line the the File object has been used from dart.io library which is not supported in the Flutter web. Am I using the library in a wrong way or is this a bug?
Error: Unsupported operation: _Namespace
dart-sdk/lib/internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49 throw
dart-sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart 200:5 get _namespace
dart-sdk/lib/io/file_impl.dart 376:45 lengthSync
packages/audio_service/audio_service.dart 969:30 _observeMediaItem
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50
dart-sdk/lib/async/zone.dart 1653:54 runUnary
dart-sdk/lib/async/future_impl.dart 147:18 handleValue
dart-sdk/lib/async/future_impl.dart 766:44 handleValueCallback
dart-sdk/lib/async/future_impl.dart 795:13 _propagateToListeners
dart-sdk/lib/async/future_impl.dart 557:7 [_complete]
dart-sdk/lib/async/stream_pipe.dart 61:11 _cancelAndValue
dart-sdk/lib/async/stream.dart 1718:11
dart-sdk/lib/async/stream_pipe.dart 11:14 _runUserCode
dart-sdk/lib/async/stream.dart 1716:7
dart-sdk/lib/async/zone.dart 1586:10 runUnaryGuarded
dart-sdk/lib/async/stream_impl.dart 339:11 [_sendData]
dart-sdk/lib/async/stream_impl.dart 515:13 perform
dart-sdk/lib/async/stream_impl.dart 620:10 handleNext
dart-sdk/lib/async/stream_impl.dart 591:7 callback
dart-sdk/lib/async/schedule_microtask.dart 40:11 _microtaskLoop
dart-sdk/lib/async/schedule_microtask.dart 49:5 _startMicrotaskLoop
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 166:15

Related

lineMatch assertion error in Flutter integration tests

I'm encountering the following error often, though it's inconsistent and I can't figure out why. I'm using tester as instructed for Flutter Integration tests.
Test Code:
testWidgets('should create and save simulation', (tester) async {
await startApp(tester, app);
await login(tester);
await navigateTo(NavPage.SIMULATOR, tester);
String scenarioName = "CreateAndSaveScenario";
await createScenario(scenarioName, tester);
expect(find.text("CRQ Simulator"), findsWidgets);
expect(find.text("Edit Scenario"), findsWidgets);
expect(find.text(scenarioName), findsWidgets);
Finder fairSwitchFinder = find.byType(Switch);
tester.tap(fairSwitchFinder);
await navigateTo(NavPage.SIMULATOR, tester);
expect(find.byType(ListTile), findsOneWidget);
expect(find.text(scenarioName), findsOneWidget);
});
Error:
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞═════════════════
The following assertion was thrown running a test:
Assertion failed:
file:///C:/Users/jared/dev/flutter/packages/flutter_test/lib/src/test_async_utils.dart:315:14
lineMatch != null
is not true
When the exception was thrown, this was the stack:
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49 throw_
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 29:3 assertFailed
packages/flutter_test/src/test_async_utils.dart 315:23 _findResponsibleMethod
packages/flutter_test/src/test_async_utils.dart 198:42 guardSync
packages/flutter_test/src/widget_tester.dart 459:18 expect$
views/simulator/crq_simulator_test.dart 37:7 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1399:47 _rootRunUnary
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1300:19 runUnary
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 147:18 handleValue
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 766:44 handleValueCallback
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 795:13 _propagateToListeners
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 566:5 [_completeWithValue]
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 639:7 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1391:13 _rootRun
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1293:19 run
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1201:7 runGuarded
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1241:23 callback
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/schedule_microtask.dart 40:11 _microtaskLoop
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/schedule_microtask.dart 49:5 _startMicrotaskLoop
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 166:15 <fn>
The test description was:
should create and save simulation
═════════════════════════════════════════════════════════════════
end of failure 1
I was expecting the tester to navigate, but after the fairSwitchFinder tap, it seems to not be able to do anything because the lineMatch is null? The error is not very descriptive
Okay, I figured this out fairly quickly afterward. Surprised there weren't any answers up, but hopefully this question shows up in searches now.
I was missing an await.
I changed
tester.tap(fairSwitchFinder); to await tester.tap(fairSwitchFinder); and it fixed it.

the search for Lat and log does not work for me

i am trying to use LocationService () in flutter web app, but it gives me the error:
Error: XMLHttpRequest error.
dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 910:28 get > > current
packages/http/src/browser_client.dart 69:22
dart-sdk/lib/async/zone.dart 1685:54
runUnary
dart-sdk/lib/async/future_impl.dart 159:18
handleValue
dart-sdk/lib/async/future_impl.dart 766:44
handleValueCallback
dart-sdk/lib/async/future_impl.dart 795:13
_propagateToListeners
dart-sdk/lib/async/future_impl.dart 592:7
[_complete]
dart-sdk/lib/async/stream_pipe.dart 61:11
_cancelAndValue
dart-sdk/lib/async/stream.dart 1288:7
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 334:14
_checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 339:39 dcall
dart-sdk/lib/html/dart2js/html_dart2js.dart 37301:58
at Object.createErrorWithStack (http://localhost:60987/dart_sdk.js:5080:12)
at Error._throw (http://localhost:60987/dart_sdk.js:20337:18)
at Error.throwWithStackTrace (http://localhost:60987/dart_sdk.js:20334:18)
at async._AsyncCallbackEntry.new.callback
(http://localhost:60987/dart_sdk.js:40851:18)
at Object._microtaskLoop (http://localhost:60987/dart_sdk.js:40708:13)
at _startMicrotaskLoop (http://localhost:60987/dart_sdk.js:40714:13)
at http://localhost:60987/dart_sdk.js:36191:9
IconButton(
onPressed: () async {
SystemChannels.textInput
.invokeMethod('TextInput.hide');
var place = await LocationService()
.getPlace(_ricercaController.text);
_goToPlace(place);
},
icon: Icon(Icons.search))

Keycloak gives me XMLHttpRequest error. with flutter but don't with postman

Goodmorning, I'm trying to use keycloak and flutter but unfortunally when i ask the token to keycloak he gives me an XMLHttpRequestError. I use thos method to ask:
Future<String> makeTokenRequest(String url,Map<String,String>params) async {
try {
print("arrivato in _restManager");
await post(url, body: params).then((result) {
print(result.toString());
});
}catch(e){
throw e;
}
}
Future<String> getToken(String email,String password) async {
try{
Map<String,String> params=Map();
params["grant_type"]="password";
params["client_id"]="myclient";
params["client_secret"]="6be8e24b-9c81-482e-99ac-05ed154e572e";
params["username"]="cappuccio";
params["password"]="franco";
String result=await _restManager.makeTokenRequest("http://localhost:8080/auth/realms/PiattaformaPrenotazioni/protocol/openid-connect/token",params);
}catch(e){
throw e;
}
}
those two methods are just toys that i'm using to learn, i know that probably they aren't the best way. I read that if i don't specify anything post method will use urlencoded and with a Map<String,String> body he will encode it right.
The Error i get is this:
Error: XMLHttpRequest error.
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 909:28 get current
packages/http/src/browser_client.dart 84:22 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1613:54 runUnary
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 155:18 handleValue
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 707:44 handleValueCallback
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 736:13 _propagateToListeners
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 533:7 [_complete]
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/stream_pipe.dart 61:11 _cancelAndValue
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/stream.dart 1219:7 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 324:14 _checkAndCall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 329:39 dcall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/html/dart2js/html_dart2js.dart 37307:58 <fn>
at Object.createErrorWithStack (http://localhost:57146/dart_sdk.js:5362:12)
at Object._rethrow (http://localhost:57146/dart_sdk.js:39548:16)
at async._AsyncCallbackEntry.new.callback (http://localhost:57146/dart_sdk.js:39542:13)
at Object._microtaskLoop (http://localhost:57146/dart_sdk.js:39374:13)
at _startMicrotaskLoop (http://localhost:57146/dart_sdk.js:39380:13)
at http://localhost:57146/dart_sdk.js:34887:9
arrivato in _restManager
errore in restManager
errore in SharedInstance
Error: XMLHttpRequest error.
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 909:28 get current
packages/http/src/browser_client.dart 84:22 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1613:54 runUnary
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 155:18 handleValue
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 707:44 handleValueCallback
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 736:13 _propagateToListeners
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 533:7 [_complete]
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/stream_pipe.dart 61:11 _cancelAndValue
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/stream.dart 1219:7 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 324:14 _checkAndCall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 329:39 dcall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/html/dart2js/html_dart2js.dart 37307:58 <fn>
at Object.createErrorWithStack (http://localhost:57146/dart_sdk.js:5362:12)
at Object._rethrow (http://localhost:57146/dart_sdk.js:39548:16)
at async._AsyncCallbackEntry.new.callback (http://localhost:57146/dart_sdk.js:39542:13)
at Object._microtaskLoop (http://localhost:57146/dart_sdk.js:39374:13)
at _startMicrotaskLoop (http://localhost:57146/dart_sdk.js:39380:13)
at http://localhost:57146/dart_sdk.js:34887:9
I had the same problems, I resolved it setting * in keycloak/your client/Valid redirect URIs

Load data into file memory in firebase storage with flutter web

I would like to know if it is possible to load data in memory from a file stored in firebase storage?
My goal is to open the file and show the data in the browser, without downloading it to the computer. Firebase is configured correctly in my project, I can upload and get URL.
I tried using the command below, but I get an error:
await FirebaseStorage.instance
.ref()
.child(TabelaIbptConsts.PATH_TABELAS)
.child('MG.csv')
.getData()
.then((value) => print(value));
I get the error below:
Error: XMLHttpRequest error.
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 909:28 get current
packages/http/src/browser_client.dart 71:22 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1613:54 runUnary
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 155:18 handleValue
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 707:44 handleValueCallback
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 736:13 _propagateToListeners
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 533:7 [_complete]
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/stream_pipe.dart 61:11 _cancelAndValue
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/stream.dart 1219:7 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 324:14 _checkAndCall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 329:39 dcall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/html/dart2js/html_dart2js.dart 37307:58 <fn>
at Object.createErrorWithStack (http://localhost:63639/dart_sdk.js:5054:12)
at Object._rethrow (http://localhost:63639/dart_sdk.js:37670:16)
at async._AsyncCallbackEntry.new.callback (http://localhost:63639/dart_sdk.js:37666:13)
at Object._microtaskLoop (http://localhost:63639/dart_sdk.js:37526:13)
at _startMicrotaskLoop (http://localhost:63639/dart_sdk.js:37532:13)
at http://localhost:63639/dart_sdk.js:33303:9

Flutter Web Dio failing to make a simple POST

Any help would be appreciated! If can't solve for Dio, what other packages is recommended for Flutter Web to do a POST (I need to be able to add followRedirect=false so the basic http package is out). Thanks!!
var resp = await Dio().post("xyz.com:1001/login", data: {"user": email, "pass" : pwd})
Get
Error: Sorry, please contact support: DioError [DioErrorType.DEFAULT]: RangeError (index): Index out of range: index should be less than 1: 1
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 236:49 throw_
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/js_array.dart 581:7 _get]
packages/dio/src/options.dart 301:29 get uri
packages/dio/src/adapters/browser_adapter.dart 30:37 <fn>
packages/dio/src/adapters/browser_adapter.dart 32:63 fetch
packages/dio/src/dio.dart 922:46 _dispatchRequest
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1612:54 runUnary
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 152:18 handleValue
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 704:44 handleValueCallback
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 733:13 _propagateToListeners
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 539:5 [_completeWithValue]
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 577:7 callback
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/schedule_microtask.dart 40:11 _microtaskLoop
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/schedule_microtask.dart 49:5 _startMicrotaskLoop
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 166:15 <fn>
at Object.throw_ [as throw] (http://localhost:56880/dart_sdk.js:5331:11)
at throwError (http://localhost:56880/packages/webcargo_mobile/user/login.dart.lib.js:818:15)
at _RootZone.runUnary (http://localhost:56880/dart_sdk.js:38886:58)
at _FutureListener.catchError.handleError (http://localhost:56880/dart_sdk.js:33886:48)
at handleError (http://localhost:56880/dart_sdk.js:34448:51)
at Function._propagateToListeners (http://localhost:56880/dart_sdk.js:34474:17)
at _Future.new.[_completeError] (http://localhost:56880/dart_sdk.js:34320:23)
at _SyncCompleter.new.[_completeError] (http://localhost:56880/dart_sdk.js:33803:36)
at _SyncCompleter.new.completeError (http://localhost:56880/dart_sdk.js:33726:29)
at onError (http://localhost:56880/dart_sdk.js:33571:60)
at _RootZone.runBinary (http://localhost:56880/dart_sdk.js:38891:58)
at _FutureListener.then.handleError (http://localhost:56880/dart_sdk.js:33884:48)
at handleError (http://localhost:56880/dart_sdk.js:34448:51)
at Function._propagateToListeners (http://localhost:56880/dart_sdk.js:34474:17)
at _Future.new.[_completeWithValue] (http://localhost:56880/dart_sdk.js:34312:23)
at async._AsyncCallbackEntry.new.callback (http://localhost:56880/dart_sdk.js:34335:35)
at Object._microtaskLoop (http://localhost:56880/dart_sdk.js:39173:13)
at _startMicrotaskLoop (http://localhost:56880/dart_sdk.js:39179:13)
at http://localhost:56880/dart_sdk.js:34686:9
Your URL is missing a scheme eg: http://
So try adding a scheme like http://example.com/login