Fix to recent dart and return a List<int> rather than a map

Further changes to deal with the evolution of Dart and also to return a List<int> in toByteArray rather than a Map as other code uses List<int> to represent byte arrays and so this is more useful.