matanshukry / flutter_google_places_sdk

Flutter plugin for google places native sdk
32 stars 68 forks source link

remove null-aware operation on non-null type #32

Closed stevenspiel closed 1 year ago

stevenspiel commented 1 year ago

The fields type is List<PlaceField>, and so the ? is not needed. This avoids the error we see in our logs

../../.pub-cache/hosted/pub.dartlang.org/flutter_google_places_sdk_platform_interface-0.2.4+3/lib/method_channel_flutter_google_places_sdk.dart:98:19: Warning: Operand of null-aware operation '?.' has type 'List<PlaceField>' which excludes null.
 - 'List' is from 'dart:core'.
 - 'PlaceField' is from 'package:flutter_google_places_sdk_platform_interface/src/types/place_field.dart' ('../../.pub-cache/hosted/pub.dartlang.org/flutter_google_places_sdk_platform_interface-0.2.4+3/lib/src/types/place_field.dart').
        'fields': fields?.map((e) => e.value).toList() ?? [],
                  ^