dart-archive / angular.dart

Legacy source repository. See github.com/dart-lang/angular
https://webdev.dartlang.org/angular/
1.25k stars 248 forks source link

Setting non-string values to Cookies #1311

Open rkirov opened 10 years ago

rkirov commented 10 years ago

Currently, setting non-string values to Cookies like cookies['a'] = 3 silently steps over due to: https://github.com/angular/angular.dart/blob/b43de31d2a9f1c0274f659ada77714e63a6d0c6a/lib/core_dom/cookies.dart#L78

This has already confused somebody: http://stackoverflow.com/questions/23051222/how-to-use-cookies-in-angulardart

We should either take any value and call toString() or annotate the appropriate methods with String so static type checking catches this.

vicb commented 10 years ago

:+1: to add a String type and throw if not String.

It don't think it would make sense to add support for num (same for List, Map & user defined objects) because you'll always get a String back. To support this usages the users should use a (de)serialization library.