Map<String, dynamic> toMap() { return <String, dynamic>{ 'code': code.index, 'message': message, }; }