Open hectorAguero opened 7 months ago
Hi @hectorAguero, please provide an example of your code that fails. Thanks!
I did find I can return a mutable map to avoid the lint message, but is more like a workaround
import 'dart:developer';
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
void main() {
/// Map<String, String> map
final map = {'key': 'value'};
/// IMap<String, String> immutableMap
final immutableMap = map.lock;
/// IMap<String, String> otherImmutableMap
final otherImmutableMap = IMap(const {"key": 'value'});
// Works fine, doesn't show any lint message:
log(map['key']!);
// Shows: avoid using the bang operator. It may result in runtime exceptions.
log(immutableMap['key']!);
log(otherImmutableMap['key']!);
// Workaround to avoid the lint message:
log(immutableMap.unlock['key']!);
log(otherImmutableMap.unlock['key']!);
}
Hi, currently using https://pub.dev/packages/fast_immutable_collections and with these lint give a warning for every IMap call.
Is feasible to add the exception? or maybe add the possibility to add valid types in the yaml file or disable the warning at all.
The warning is "Avoid using the bang operator. It may result in runtime exceptions."