Last active
September 11, 2020 17:32
-
-
Save viveky259259/5d43a245b4f8d0c88af74b02e0a6cda6 to your computer and use it in GitHub Desktop.
Auto generated PersonModelAdapter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GENERATED CODE - DO NOT MODIFY BY HAND | |
part of 'person.model.dart'; | |
// ************************************************************************** | |
// TypeAdapterGenerator | |
// ************************************************************************** | |
class PersonModelAdapter extends TypeAdapter<PersonModel> { | |
@override | |
final typeId = 1; | |
@override | |
PersonModel read(BinaryReader reader) { | |
var numOfFields = reader.readByte(); | |
var fields = <int, dynamic>{ | |
for (var i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), | |
}; | |
return PersonModel( | |
fields[0] as int, | |
fields[1] as String, | |
fields[2] as DateTime, | |
); | |
} | |
@override | |
void write(BinaryWriter writer, PersonModel obj) { | |
writer | |
..writeByte(3) | |
..writeByte(0) | |
..write(obj.id) | |
..writeByte(1) | |
..write(obj.name) | |
..writeByte(2) | |
..write(obj.birthDate); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment