toJSON method
Transforms this instance into a JSON object.
Implementation
Map<String,dynamic> toJSON() {
final Map<String,dynamic> json = {
'type': runtimeType.toString(),
'owner': owner?.uuid,
'fieldOfView': fieldOfView,
'range': range.toString()
};
json['obstacles'] = [];
for ( int i = 0, l = obstacles.length; i < l; i ++ ) {
final obstacle = obstacles[ i ];
json['obstacles'].add( obstacle.uuid );
}
return json;
}