Purely functional constructs in dart