flutter_reactive_ble icon indicating copy to clipboard operation
flutter_reactive_ble copied to clipboard

Can't build with 5.0.3: The getter 'Uint8List' isn't defined for the class 'ProtobufConverterImpl'.

Open wabash9000 opened this issue 2 years ago • 11 comments

I had a build working with 5.0.2 and then had to modify my pubspec.yaml to add an image asset to the build and it upgraded me to 5.0.3 and now I can't get my project to build. I tried removing 5.0.3 and setting pubspec to not upgrade from 5.0.2 and now there are errors with 5.0.2 that didn't happen before.

5.0.3 errors: /C:/flutter/.pub-cache/hosted/pub.dartlang.org/reactive_ble_mobile-5.0.3/lib/src/converter/protobuf_converter.dart:49:42: Error: The getter 'Uint8List' isn't defined for the class 'ProtobufConverterImpl'.

  • 'ProtobufConverterImpl' is from 'package:reactive_ble_mobile/src/converter/protobuf_converter.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/reactive_ble_mobile-5.0.3/lib/src/converter/protobuf_converter.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'Uint8List'. message.serviceData.map((entry) => Uint8List.fromList(entry.data)), ^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/reactive_ble_mobile-5.0.3/lib/src/converter/protobuf_converter.dart:63:29: Error: The getter 'Uint8List' isn't defined for the class 'ProtobufConverterImpl'.
  • 'ProtobufConverterImpl' is from 'package:reactive_ble_mobile/src/converter/protobuf_converter.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/reactive_ble_mobile-5.0.3/lib/src/converter/protobuf_converter.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'Uint8List'. manufacturerData: Uint8List.fromList(message.manufacturerData), ^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/reactive_ble_mobile-5.0.3/lib/src/converter/protobuf_converter.dart:61:24: Error: The argument type 'Map<Uuid, dynamic>' can't be assigned to the parameter type 'Map<Uuid, Uint8List>'.
  • 'Map' is from 'dart:core'.
  • 'Uuid' is from 'package:reactive_ble_platform_interface/src/model/uuid.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/reactive_ble_platform_interface-5.0.3/lib/src/model/uuid.dart').
  • 'Uint8List' is from 'dart:typed_data'. serviceData: serviceData, ^

I get a similar Uint8List error in 5.0.2 now.

wabash9000 avatar Dec 08 '22 21:12 wabash9000

I guess I should add context, trying to build for Android from Android Studio, but I also build for iOS, but haven't tried since this issue popped up.

wabash9000 avatar Dec 08 '22 23:12 wabash9000

same problem,my solution is to lock 5.0.2 and clear cache.

wsmzdyss avatar Dec 12 '22 11:12 wsmzdyss

@wsmzdyss How can I lock the package version? I wrote "flutter_reactive_ble: 5.0.2" in pubspec.yaml file. (beroe this issue happen, I have writen "flutter_reactive_ble: ^5.0.2"). And now, this issue still occur.

SungchangChoi avatar Dec 13 '22 07:12 SungchangChoi

@SungchangChoi you need clear cache, I remove project from Android Studio and reopen it.

wsmzdyss avatar Dec 13 '22 08:12 wsmzdyss

flutter_reactive_ble was still throwing errors after I locked it to 5.0.2 in my pubspec.yaml and ran 'Invalidate Cache / Restart...' in Android Studio. I had to open the flutter_reactive_ble files and modify the pubspec.yaml in the plugin because it had references to reactive_ble_mobile and reactive_ble_platform_interface both of which had the ^ on them so it was updating them and throwing errors as well.

wabash9000 avatar Dec 13 '22 14:12 wabash9000

You also need to enter the /flutter/.pub-cache/hosted/xxxx/ folder and delete the cache of version 5.0.3

wsmzdyss avatar Dec 14 '22 07:12 wsmzdyss

If anyone struggles with the same issue, you need to upgrade flutter to version 3.3.0 or higher.

rfuerst87 avatar Dec 14 '22 14:12 rfuerst87

rsion 3.3.0

pubspec.lock modify version to 5.0.2

Liberations avatar Dec 28 '22 09:12 Liberations

I have upgraded to flutter 3.3.3 now i am not having thiss issue

NavneetTechlene avatar Dec 28 '22 09:12 NavneetTechlene

I am on Flutter 3.3.9, flutter_reactive_ble 5.0.0 and im having this issue. by this issue i mean :-

Error: 'Logger' is imported from both 'package:flutter_reactive_ble/src/debug_logger.dart' and 'package:reactive_ble_platform_interface/src/logger.dart'.
import 'package:reactive_ble_platform_interface/reactive_ble_platform_interface.dart';
reactive_ble_platform_interface.dart:1
^^^^^^

vontdeux avatar Apr 01 '23 01:04 vontdeux

@vontdeux It's because of the way pubspec resolves transitive dependencies. I had the same issue and had to add dependency_override for reactive_ble_platform_interface: 5.0.2. Since the main package can still use caret syntax, even if you constrain flutter_reactive_ble version, it still might resolve its dependency to a newer version that's not compatible.

mateuszwojtczak avatar Apr 18 '23 07:04 mateuszwojtczak