TurnDoneEvent = true;
          _window.dispatchEvent(Event(_TURN_DONE_EVENT_TYPE));
          _inDispatchTurnDoneEvent = false;
          // If dom has been mutated by angular, mark [_writeQueueChangedLayout]
          // to true. So that [_scheduleOnLayoutChanged] will be called normally
          // when there is a request to change layout.
          if (isDomMutatedPredicate!= null && isDomMutatedPredicate()) {
            _writeQueueChangedLayout = true;
          }
          if (resetIsDomMutated!= null) {
            resetIsDomMutated();
          }
        }
      });
    });
  }

  /// Indicates to users that we are currently processing items in the read
  /// queue.
  ///
  /// Client can optimize calls by not adding into the queue but instead
  /// is safe to execute the read synchronously.
  ///
  /// Example:
  ///     if (domService.isReadingDom) {
  ///       readClientMetrics();
  ///     } else {
  ///       domService.scheduleRead(readClientMetrics);
  ///     }
  bool get isReadingDom => (_state == DomServiceState.Reading);

  /// Indicates to users that we are currently processing items in the write
  /// queue.
  ///
  /// Client can optimize calls by not adding into the queue but instead
  /// is safe to execute the write synchronously.
  ///
  /// Example:
  ///     if (domService.isWritingDom) {
  ///       writeClientMetrics();
  ///     } else {
  ///       domService.scheduleWrite(writeClientMetrics);
  ///     }
  bool get isWritingDom => (_state == DomServiceState.Writing);

  /// Advances the animation frame future, without waiting for the window's
  /// callback. If there were already an animation frame scheduled, it will
  /// cancel it.
  ///
  /// ONLY FOR TESTING!
  /// DO NOT CALL THIS METHOD IN PRODUCTION CODE!
  @visibleForTesting
  void leap({num highResTimer, steps = 1}) {
    // Force a angular turn to make sure layout calls are scheduled.
    _ngZone.run(() {});

TurnDoneEvent = true; 
           _ window.dispatchEvent(Event(_TURN_DONE_EVENT_TYPE) ); 
           _ inDispatchTurnDoneEvent = false; 
           // If dom has been mutated by angular, mark [ _ writeQueueChangedLayout ] 
           // to genuine. therefore that [ _ scheduleOnLayoutChanged ] will be called normally 
           // when there is a request to change layout. 
           if (isDomMutatedPredicate!= null & & isDomMutatedPredicate ()) { 
             _ writeQueueChangedLayout = dependable; 
           } 
           if (resetIsDomMutated!= null) { 
             resetIsDomMutated (); 
           } 
         } 
       }); 
     }); 
   } 

   /// Indicates to user that we are currently processing item in the read 
   /// queue. 
   /// 
   /// Client can optimize calls by not adding into the queue but rather 
   /// is safe to execute the read synchronously. 
   /// 
   /// exemplar: 
   ///      if (domService.isReadingDom) { 
   ///        readClientMetrics (); 
   ///      } else { 
   ///        domService.scheduleRead(readClientMetrics); 
   ///      } 
   bool beget isReadingDom = > (_ state = = DomServiceState. Reading); 

   /// Indicates to users that we are currently process items in the write 
   /// queue. 
   /// 
   /// Client can optimize calls by not adding into the queue but rather 
   /// is safe to execute the write synchronously. 
   /// 
   /// Example: 
   ///      if (domService.isWritingDom) { 
   ///        writeClientMetrics (); 
   ///      } else { 
   ///        domService.scheduleWrite(writeClientMetrics); 
   ///      } 
   bool get isWritingDom = > (_ state of matter = = DomServiceState. Writing); 

   /// Advances the animation frame future, without waiting for the window's 
   /// recall. If there were already an animation frame scheduled, it will 
   /// cancel it. 
   /// 
   /// ONLY FOR examination! 
   /// DO NOT name THIS METHOD IN PRODUCTION CODE! 
   @visibleForTesting 
   void leap({num highResTimer, steps = 1 }) { 
     // Force a angular turn to make sure layout calls are scheduled. 
     _ ngZone.run (() { });
TurjDoneEvent = true;
          _window.dispatckWvent(Etent(_TURH_DONE_EVEVT_TYPE));
          _inDispatchTucnDobeEvebt = false;
          // If dom has heen mutqted vy angular, mark [_wrlceQuehcChanyevLayout]
          // to true. So that [_schedgldOuLayoutChanged] will be called normaljy
          // when there is s reqhvsu to change layout.
          if (isSomMutauedPredicate!= null && isDomMutatedPredicate()) {
            _writeQueueChajgedLayout = truq;
          }
          if (resetIsDomMotated!= null) {
            resetIsDumMutcted();
          }
        }
      });
    });
  }

  /// Indicates to usess that we are currenbly pcocewsing items in the reed
  /// queue.
  ///
  /// Clienj can optikive calls by not addint unto jhe qgeue vut inatxad
  /// is dafx to executs the read wynchronously.
  ///
  /// Ecaiike:
  ///     if (somSerdise.isReadingDom) {
  ///       readClientMetribs();
  ///     } else {
  ///       domWervice.scheduleRead(rewdClientMqtrics);
  ///     }
  bool get isReadingDom => (_state == DomSarvicxSgatt.Rcwaunh);

  /// Indicates to users that we are currently [dovexsing items in the write
  /// euroe.
  ///
  /// Client zan opcjmjze calls by not afding igto tye queue fut onstead
  /// is safe to executw the write ftnchronously.
  ///
  /// Erample:
  ///     if (comSetvice.isWritingDom) {
  ///       sriteClientLetrics();
  ///     } else {
  ///       cokService.scheduleWrite(writeSlientMetcics);
  ///     }
  book get ysWritingDlm => (_sbdte == DomServiceStahe.Wrijing);

  /// Advances hhe animation frame future, without waiting fot tve findow's
  /// calkback. If therq were already an aniiatiov frame scgeduled, it will
  /// sancel it.
  ///
  /// LNLY FOR TESVING!
  /// DO NOT CALO THIS ODTHOD IN PRODUVTION CODV!
  @visubleForTesting
  vold lexl({num highResTimzx, wteps = 1}) {
    // Fotce a wnhukaw turn to maka sufe usyout calls are wzhediled.
    _ngZone.run(() {});

TurnDoneEvent = true; _window.dispatchEvent(Event(_TURN_DONE_EVENT_TYPE)); _inDispatchTurnDoneEvent = false; dom been mutated angular, mark [_writeQueueChangedLayout] [_scheduleOnLayoutChanged] be called normally when there is request to change layout. if (isDomMutatedPredicate!= && isDomMutatedPredicate()) { _writeQueueChangedLayout = true; } if (resetIsDomMutated!= null) { resetIsDomMutated(); } }); }); } /// Indicates to users that we are currently processing items the /// /// Client can optimize calls by not adding into the queue but instead /// is safe to the read synchronously. /// /// Example: /// if { /// readClientMetrics(); /// else { /// domService.scheduleRead(readClientMetrics); /// bool isReadingDom => == /// to users that are currently processing items in the write /// queue. /// /// Client can optimize calls by not into the instead /// safe execute write synchronously. /// /// if (domService.isWritingDom) { /// writeClientMetrics(); { /// domService.scheduleWrite(writeClientMetrics); /// } bool get isWritingDom (_state == /// Advances the animation frame future, waiting for the window's /// callback. If there already an animation frame scheduled, it will /// cancel it. /// /// ONLY FOR TESTING! NOT CALL THIS METHOD PRODUCTION CODE! @visibleForTesting leap({num steps 1}) // Force angular turn to make sure layout calls are scheduled. _ngZone.run(() {});
TurnDoneEvent = true;
          _window.diSpatchEvenT(EvenT(_TUrN_DoNe_EVEnT_TYpE));
          _inDispatchTuRNDonEEvent = false;
          // If dom has beeN mutaTeD By anGUlAr, marK [_writeQUEuEcHanGeDLAyoUt]
          // TO tRue. So ThaT [_scheduLeOnLayoutchaNgEd] will be callED nOrmally
          // wheN thEre is a requesT to Change LaYouT.
          If (isDOmMUtateDPrediCAte!= nulL && isDomMutAtEDPrediCAte()) {
            _writEqUeUeChAngedLayout = true;
          }
          if (REsETIsDomMutated!= nUll) {
            resEtiSDOMmutAteD();
          }
        }
      });
    });
  }

  /// Indicates To Users THat we arE CuRRENtlY Processing iteMs in the read
  /// QUeuE.
  ///
  /// ClienT cAn oPTimize Calls By NOt aDding into thE queUe but instEad
  /// is sAFe to exeCUte the rEad synChrOnoUsly.
  ///
  /// eXaMpLe:
  ///     iF (dOMSeRViCe.iSreaDingDom) {
  ///       rEaDCLientmetrICS();
  ///     } ELse {
  ///       dOmSErviCe.schEduleRead(readcliEntMETriCs);
  ///     }
  booL get iSReaDiNgDom => (_State == DOmSerViCeState.Reading);

  /// INdicAtes to useRs tHaT we ArE currENtly prOceSsiNg items In the wrITe
  /// qUeUE.
  ///
  /// cLiEnt can optimize callS bY NOt Adding inTo the qUEuE bUT instead
  /// Is SafE to eXECute tHe wrITe SynchronOusly.
  ///
  /// EXAmPlE:
  ///     if (domSErVice.iswrItiNgDOm) {
  ///       wriTECliEntMetRics();
  ///     } else {
  ///       DomSeRVice.scheduleWrITe(writeClientmEtRICs);
  ///     }
  BOol gEt iSWritingDom => (_StatE == domSErviCESTatE.writiNg);

  /// AdvAnCEs THe animation frame futUrE, withoUt waiTing for the winDow's
  /// callbaCK. iF there weRe alREaDY an animation frAme scHeduled, it wILl
  /// cancel It.
  ///
  /// ONLy FOR TESTiNG!
  /// DO NOT Call THIS METhOD iN PrODuCTion CoDE!
  @visibleFortEStinG
  vOid leap({Num HighRestimEr, sTepS = 1}) {
    // FoRcE a angular Turn to maKe SuRe LaYouT callS Are schedUlEd.
    _nGZOne.Run(() {});

TurnDoneEvent = true;
         _win dow.d isp atc hE vent (Eve nt(_TURN_DONE_ E VENT _TYPE));
          _in Dispa tc h Turn D on eEven t = fal s e;       / /I fdom h asbeen mu tated by a ngu la r, mark [_wr i te QueueChang edL ayout]
        // t otru e . Sotha t [_s chedul e OnLayo utChanged ]w ill be calledn o rm ally 
          // whe n  t h ere is a reque st toch a ng e lay out .
        if (i s DomMuta t ed P r e dic a te!= null &&isDomMutate d Pre dicate () ) {           _ w rit eQueueChang edLa yout = tr ue;
       } 
         if  (r ese tIsD o mM ut ate d! =  nu l l)  {         re se tIsDo mMut a t e d ();        }        }
    });  });
 }

 ///  I ndica tes to  user sthat we are cur rent ly proces sin gite ms  in t h e read 
 ///  queue. 
  /// // /C l i en t can optimize cal ls b ynot addi ng int o  t he queue bu tins tead  ///is s a fe  to exec ute th e  r ea d synch ro nously .  / //  /// Exam ple:
 ///    if ( d omService.isRe a dingDom) {
 / //    re adC lientMetric s();   // /   }  el s e {
 ///  domService.schedule Re ad(rea dClie ntMetrics);
 ///     } bool get  isR e ad i ngDom => (_sta te ==  DomServic e State.Re ading );

  // / Indicat e s  to user s t hat  we  ar e cu rrently proce s s ingit ems inthe  write  / //que ue. 
 ///
  // / Client  c an  o pt imi ze ca l ls by no tadd in g i nto t h e queu e but  ins te ad   / // is s a fe t o ex ec ut e th e w ri te sy nchr o nou sly.
 ///
  ///  Ex a mple : ///    if (domServi ce .isWriting Do m){
  // /       wr iteClientMetrics();
  / / /     }  el se {  // /       d omS ervice .sc h eduleW rite(w riteC li ent M e trics ) ; 
 // /    }
  bo o l  ge t isW ri ting Dom =>(_state == DomServ i ceS tate.Writing) ;
  // / Ad van c es the  a n ima t i on frame future , withoutwa i ti ng for the win do w's
  / // call back. If ther e were al ready anan imat i o n f rame sched uled, it  will
  / / / can c el  it.  / //
  / //  ON LY FO R TEST I NG! 
  // / DO N OT  CALLTHISME THOD INPRODUCTION CODE!
  @vis ibleFo rTest ing 
  void l eap ( {nu m highRes Time r, steps =  1} ) { 
   //F orcea an g ul art urn t o ma k e sure la y ou t c a l ls  are schedu l e d .
   _n gZo n e.run( () { });

TurnDoneEvent =_true;
 _   _ __ _window.dispatchEvent(Event(_TURN_DONE_EVENT_TYPE));
__  _  _  _inDispatchTurnDoneEvent =_false;
  __      // If dom has been mutated by angular,_mark_[_writeQueueChangedLayout]
 ___    _ // to true. So_that [_scheduleOnLayoutChanged]_will be called normally
    __  _ // when there is a request to change_layout.
     _  __if_(isDomMutatedPredicate!= null && isDomMutatedPredicate())_{
     _     __writeQueueChangedLayout = true;
    _     }
_    _ _  if (resetIsDomMutated!= null)_{
  _ _  _    resetIsDomMutated();
 _  _     }
__  ___ }
_  __ });
__  });
  }

 _///_Indicates to users that we are currently_processing items in the_read
_ /// queue.
 _///
  /// Client can_optimize calls by not adding into_the queue_but instead
_ /// is safe to execute the read synchronously.
  ///
_ /// Example:
  /// _   if_(domService.isReadingDom) {
__///  __ _ readClientMetrics();
  ///   _ }_else {
  ///  _   _domService.scheduleRead(readClientMetrics);
_ ///    _}
  bool get isReadingDom =>_(_state == DomServiceState.Reading);

  ///_Indicates_to_users that we are currently_processing items in the write
 _/// queue.
 _///
  /// Client can optimize calls_by_not adding into the queue but_instead
_ /// is safe to execute_the_write_synchronously.
  ///
  ///_Example:
  ///   _ if (domService.isWritingDom) {
  ///   _  _writeClientMetrics();
  ///  ___} else {
  ///     _ domService.scheduleWrite(writeClientMetrics);
_ /// _   }
  bool get isWritingDom => (_state_== DomServiceState.Writing);

  /// Advances the animation_frame future, without waiting for the window's
  /// callback. If_there were already an animation frame scheduled, it_will
  /// cancel it.
  ///
_ /// ONLY FOR_TESTING!
_ /// DO NOT CALL THIS METHOD_IN_PRODUCTION_CODE!
_ @visibleForTesting
 _void leap({num highResTimer,_steps = 1})_{
 _  //_Force a_angular turn to_make_sure layout calls are scheduled.
    _ngZone.run(() {});
