Typo fix
Removed usage of 'as' and changed to use a variable of correct type instead per recommendation of Gilad Bracha (https://groups.google.com/a/dartlang.org/d/msg/misc/nsKVsVmMZ2I/co5CIEEm0s8J)