thingsboard/flutter_thingsboard_pe_app

Error: The argument type 'Uri' can't be assigned to the parameter type 'WebUri?'

Tomi05-k opened this issue · 6 comments

Hello everyone,
Unfortunately, I keep getting stuck with this error:

`Hallo
Running Xcode build...
Xcode build done. 27,5s
Failed to build iOS app
Could not build the precompiled application for the device.
Error (Xcode): lib/modules/dashboard/dashboard.dart:157:33: Error: The argument type 'Uri' can't be assigned to the parameter type 'WebUri?'.
Error launching application on iPhone 13 Pro von Tom.

What is the problem here?
I am looking forward to your help.
Best regards Tom!

Hey Tom,
I am building for Android, but ran into the same issue a few days ago. Changing Uri.parse('*') to WebUri.uri(Uri.parse('*')) (or accordingly based on current expression) did the job for me. I assume this might be due to some library version incompatibilities... but I didn't investigate further. This is just a quick fix.

Cool thanks, that works, unfortunately there is still a second problem:

initialUrlRequest: URLRequest(url: _initialUrl),

Error (Xcode): lib/modules/dashboard/dashboard.dart:296:60: Error: The argument type 'Uri' can't be assigned to the parameter type 'WebUri?'.

Do you think this is just a small thing?

Yep, basically the same issue. You need to change it to URLRequest(url: WebUri.uri(_initialUrl))

I have tried a lot again, your tips have also helped, but there are now two more errors.
Namely these:

lib/utils/services/widget_action_handler.dart:290:29: Error: The argument type 'List?' can't be assigned to the parameter type 'List' because 'List?' is nullable and 'List' isn't.

  • 'List' is from 'dart:core'.
    UriData.fromBytes(imageBytes, mimeType: 'image/png').toString();
    ^
    lib/modules/alarm/alarms_base.dart:53:27: Error: The argument type 'String?' can't be assigned to the parameter type 'String' because 'String?' is nullable and 'String' isn't.
    navigateToDashboard(dashboardId,
    ^
    Target kernel_snapshot failed: Exception

FAILURE: Build completed with 2 failures.

I would strongly suggest you to just google these things. These are very basic issues that come up during the debugging of any code. I genuinely think that this would help you more than just me providing you with an answer :)

Hello all,

The Flutter version 3.19.6 is currently officially supported. So I recommend using this version so far, or you can use https://fvm.app/