package Ġio . c arius . lar s . ar _ flutter _ plugin . Serialization Ċ Ċ import Ġcom . google . ar . core .* Ċ import Ġcom . google . ar . scene form . Anchor Node Ċ Ċ fun Ġserialize Hit Result ( hit Result : ĠHit Result ): ĠHashMap < String , ĠAny > Ġ{ ĊĠĠĠ Ġval Ġserialized Hit Result Ġ= ĠHashMap < String , Any >() ĊĊĠĠĠ Ġif Ġ( hit Result . track able Ġis ĠPlane Ġ&& Ġ( hit Result . track able Ġas ĠPlane ). is Pose In Polygon ( hit Result . hit Pose )) Ġ{ ĊĠĠĠĠĠĠĠ Ġserialized Hit Result [" type "] Ġ= Ġ 1 Ġ// ĠType Ġplane ĊĠĠĠ Ġ} ĊĠĠĠ Ġelse Ġif Ġ( hit Result . track able Ġis ĠPoint ){ ĊĠĠĠĠĠĠĠ Ġserialized Hit Result [" type "] Ġ= Ġ 2 Ġ// ĠType Ġpoint ĊĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠ Ġserialized Hit Result [" type "] Ġ= Ġ 0 Ġ// ĠType Ġundefined ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġserialized Hit Result [" distance "] Ġ= Ġhit Result . distance . toDouble () ĊĠĠĠ Ġserialized Hit Result [" world Transform "] Ġ= Ġserialize Pose ( hit Result . hit Pose ) ĊĊĠĠĠ Ġreturn Ġserialized Hit Result Ċ } Ċ Ċ fun Ġserialize Pose ( pose : ĠP ose ): ĠDouble Array Ġ{ ĊĠĠĠ Ġval Ġserialized Pose Ġ= ĠFloat Array ( 1 6 ) ĊĠĠĠ Ġpose . to Matrix ( serialized Pose , Ġ 0 ) ĊĠĠĠ Ġ// Ġcopy Ġinto Ġdouble ĠArray ĊĠĠĠ Ġval Ġserialized Pose Double Ġ= ĠDouble Array ( serialized Pose . size ) ĊĠĠĠ Ġfor Ġ( i Ġin Ġserialized Pose . indices ) Ġ{ ĊĠĠĠĠĠĠĠ Ġserialized Pose Double [ i ] Ġ= Ġserialized Pose [ i ]. toDouble () ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġserialized Pose Double Ċ } Ċ Ċ fun Ġserialize Anchor ( anchor Node : ĠAnchor Node , Ġanchor : ĠAnchor ?): ĠHashMap < String , ĠAny ?> Ġ{ ĊĠĠĠ Ġval Ġserialized Anchor Ġ= ĠHashMap < String , ĠAny ?> () ĊĠĠĠ Ġserialized Anchor [" type "] Ġ= Ġ 0 Ġ// Ġindex Ġfor Ġplane Ġanchors ĊĠĠĠ Ġserialized Anchor [" name "] Ġ= Ġanchor Node . name ĊĠĠĠ Ġserialized Anchor [" cloud anchor id "] Ġ= Ġanchor ?. cloud Anchor Id ĊĠĠĠ Ġserialized Anchor [" transformation "] Ġ= Ġif Ġ( anchor Ġ!= Ġnull ) Ġserialize Pose ( anchor . pose ) Ġelse Ġnull ĊĠĠĠ Ġserialized Anchor [" childNodes "] Ġ= Ġanchor Node . children . map Ġ{ Ġchild Ġ-> Ġchild . name Ġ} ĊĊĠĠĠ Ġreturn Ġserialized Anchor Ċ }