Fixed code not working with stable dart release due to breaking changes in standard library