Description
There are a couple of instances where collection emptiness is checked via .length > 0 (e.g., in querya_tab_strip.dart and json_rpc_payload_limits.dart).
Why is this a problem?
The .length property on some Dart iterables might require walking the entire collection to count items, whereas .isNotEmpty operates in O(1) time by just checking if the iterator has at least one element.
Proposed Solution
Replace all usages of .length > 0 or .length == 0 with .isNotEmpty and .isEmpty respectively.
Description
There are a couple of instances where collection emptiness is checked via
.length > 0(e.g., inquerya_tab_strip.dartandjson_rpc_payload_limits.dart).Why is this a problem?
The
.lengthproperty on some Dart iterables might require walking the entire collection to count items, whereas.isNotEmptyoperates inO(1)time by just checking if the iterator has at least one element.Proposed Solution
Replace all usages of
.length > 0or.length == 0with.isNotEmptyand.isEmptyrespectively.