dint-dev / universal_html

Cross-platform 'dart:html'.
https://pub.dev/packages/universal_html
Apache License 2.0
201 stars 60 forks source link

window.location.pathname returns String instead of String? #56

Closed minhqdao closed 2 years ago

minhqdao commented 2 years ago

window.location.pathname is supposed to return a String?, which is why you would typically use it as:

final isHome = window.location.pathname?.contains('home') ?? false;

If you do that, however, you will receive the following warning under macOS:

: Warning: Operand of null-aware operation '?.' has type 'String' which excludes null.

Seems like somewhere a String is returned, while a String? would be more appropriate. 🤔

radvansky-tomas commented 2 years ago

There is same issue for window.location.origin