pauldemarco / flutter_blue

Bluetooth plugin for Flutter
BSD 3-Clause "New" or "Revised" License
2.36k stars 1.23k forks source link

Warning: Operand of null-aware operation '??' #904

Open JAICHANGPARK opened 2 years ago

JAICHANGPARK commented 2 years ago
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.8.0/lib/src/bluetooth_characteristic.dart:30:37: Warning: Operand of null-aware operation '??' has type 'List<int>' which excludes null.
 - 'List' is from 'dart:core'.
  List<int> get lastValue => _value.value ?? [];
                                    ^
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.8.0/lib/src/bluetooth_descriptor.dart:18:37: Warning: Operand of null-aware operation '??' has type 'List<int>' which excludes null.
 - 'List' is from 'dart:core'.
  List<int> get lastValue => _value.value ?? [];
                                    ^
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.8.0/lib/src/flutter_blue.dart:134:33: Warning: Operand of null-aware operation '??' has type 'List<ScanResult>' which excludes null.
 - 'List' is from 'dart:core'.
 - 'ScanResult' is from 'package:flutter_blue/flutter_blue.dart' ('../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.8.0/lib/flutter_blue.dart').
      final list = _scanResults.value ?? [];
                                ^
ifredom commented 2 years ago
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.8.0/lib/src/bluetooth_characteristic.dart:30:37: Warning: Operand of null-aware operation '??' has type 'List<int>' which excludes null.
 - 'List' is from 'dart:core'.
  List<int> get lastValue => _value.value ?? [];
                                    ^
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.8.0/lib/src/bluetooth_descriptor.dart:18:37: Warning: Operand of null-aware operation '??' has type 'List<int>' which excludes null.
 - 'List' is from 'dart:core'.
  List<int> get lastValue => _value.value ?? [];
                                    ^
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.8.0/lib/src/flutter_blue.dart:134:33: Warning: Operand of null-aware operation '??' has type 'List<ScanResult>' which excludes null.
 - 'List' is from 'dart:core'.
 - 'ScanResult' is from 'package:flutter_blue/flutter_blue.dart' ('../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.8.0/lib/flutter_blue.dart').
      final list = _scanResults.value ?? [];
                                ^

I also encountered the same problem. How did I solve it?

GPlay97 commented 2 years ago

Any news?