@@ -534,13 +534,13 @@ class Event extends MatrixEvent {
534534  }
535535
536536  /// Gets the info map of file events, or a blank map if none present 
537-    Map  get  infoMap => 
537+    Map < String ,  Object ?>  get  infoMap => 
538538      content.tryGetMap <String , Object ?>('info' ) ??  < String , Object ? > {};
539539
540540  /// Gets the thumbnail info map of file events, or a blank map if nonepresent 
541-    Map  get  thumbnailInfoMap =>  infoMap['thumbnail_info' ] is  Map 
542-       ?  infoMap['thumbnail_info' ]
543-       :  < String , dynamic > {};
541+    Map < String ,  Object ?>  get  thumbnailInfoMap =>  infoMap['thumbnail_info' ] is  Map 
542+       ?  ( infoMap['thumbnail_info' ]  as   Map ). cast < String ,  Object ?>() 
543+       :  < String , Object ? > {};
544544
545545  /// Returns if a file event has an attachment 
546546   bool  get  hasAttachment =>  content['url' ] is  String  ||  content['file' ] is  Map ;
@@ -556,20 +556,18 @@ class Event extends MatrixEvent {
556556   bool  get  isThumbnailEncrypted =>  infoMap['thumbnail_file' ] is  Map ;
557557
558558  /// Gets the mimetype of the attachment of a file event, or a blank string if not present 
559-    String  get  attachmentMimetype =>  infoMap['mimetype' ] is  String 
560-       ?  infoMap['mimetype' ].toLowerCase ()
561-       :  (content
562-               .tryGetMap <String , Object ?>('file' )
563-               ? .tryGet <String >('mimetype' ) ?? 
559+    String  get  attachmentMimetype => 
560+       infoMap.tryGet <String >('mimetype' )? .toLowerCase () ?? 
561+       (content.tryGetMap <String , Object ?>('file' )? .tryGet <String >('mimetype' ) ?? 
564562          '' );
565563
566564  /// Gets the mimetype of the thumbnail of a file event, or a blank string if not present 
567-    String  get  thumbnailMimetype =>  thumbnailInfoMap[ 'mimetype' ]  is   String 
568-       ?   thumbnailInfoMap[ 'mimetype' ] .toLowerCase ()
569-       :   (infoMap[ 'thumbnail_file' ]  is   Map   && 
570-               infoMap[ 'thumbnail_file' ][ 'mimetype' ]  is   String 
571-           ?  infoMap[ 'thumbnail_file' ][ ' mimetype'] 
572-           :   '' );
565+    String  get  thumbnailMimetype => 
566+       thumbnailInfoMap. tryGet < String >( 'mimetype' ) ? .toLowerCase ()  ?? 
567+       (infoMap
568+               . tryGetMap < String ,  Object ?>( 'thumbnail_file' ) 
569+                ? . tryGet < String >( ' mimetype')  ?? 
570+           '' );
573571
574572  /// Gets the underlying mxc url of an attachment of a file event, or null if not present 
575573   Uri ?  get  attachmentMxcUrl {
@@ -582,7 +580,7 @@ class Event extends MatrixEvent {
582580  /// Gets the underlying mxc url of a thumbnail of a file event, or null if not present 
583581   Uri ?  get  thumbnailMxcUrl {
584582    final  url =  isThumbnailEncrypted
585-         ?  infoMap['thumbnail_file' ]['url' ]
583+         ?  ( infoMap['thumbnail_file' ]  as   Map ) ['url' ]
586584        :  infoMap['thumbnail_url' ];
587585    return  url is  String  ?  Uri .tryParse (url) :  null ;
588586  }
@@ -592,7 +590,7 @@ class Event extends MatrixEvent {
592590    if  (getThumbnail && 
593591        infoMap['size' ] is  int  && 
594592        thumbnailInfoMap['size' ] is  int  && 
595-         infoMap['size' ] <=  thumbnailInfoMap['size' ]) {
593+         ( infoMap['size' ] as   int )  <=  ( thumbnailInfoMap['size' ]  as   int ) ) {
596594      getThumbnail =  false ;
597595    }
598596    if  (getThumbnail &&  ! hasThumbnail) {
@@ -641,20 +639,20 @@ class Event extends MatrixEvent {
641639    if  (getThumbnail && 
642640        method ==  ThumbnailMethod .scale && 
643641        thisInfoMap['size' ] is  int  && 
644-         thisInfoMap['size' ] <  minNoThumbSize) {
642+         ( thisInfoMap['size' ]  as   int )  <  minNoThumbSize) {
645643      getThumbnail =  false ;
646644    }
647645    // now generate the actual URLs 
648646    if  (getThumbnail) {
649-       return  await  Uri .parse (thisMxcUrl).getThumbnailUri (
647+       return  await  Uri .parse (thisMxcUrl  as   String ).getThumbnailUri (
650648        room.client,
651649        width:  width,
652650        height:  height,
653651        method:  method,
654652        animated:  animated,
655653      );
656654    } else  {
657-       return  await  Uri .parse (thisMxcUrl).getDownloadUri (room.client);
655+       return  await  Uri .parse (thisMxcUrl  as   String ).getDownloadUri (room.client);
658656    }
659657  }
660658
@@ -696,20 +694,20 @@ class Event extends MatrixEvent {
696694    if  (getThumbnail && 
697695        method ==  ThumbnailMethod .scale && 
698696        thisInfoMap['size' ] is  int  && 
699-         thisInfoMap['size' ] <  minNoThumbSize) {
697+         ( thisInfoMap['size' ]  as   int )  <  minNoThumbSize) {
700698      getThumbnail =  false ;
701699    }
702700    // now generate the actual URLs 
703701    if  (getThumbnail) {
704-       return  Uri .parse (thisMxcUrl).getThumbnail (
702+       return  Uri .parse (thisMxcUrl  as   String ).getThumbnail (
705703        room.client,
706704        width:  width,
707705        height:  height,
708706        method:  method,
709707        animated:  animated,
710708      );
711709    } else  {
712-       return  Uri .parse (thisMxcUrl).getDownloadLink (room.client);
710+       return  Uri .parse (thisMxcUrl  as   String ).getDownloadLink (room.client);
713711    }
714712  }
715713
@@ -728,7 +726,7 @@ class Event extends MatrixEvent {
728726    final  database =  room.client.database;
729727
730728    final  storeable =  thisInfoMap['size' ] is  int  && 
731-         thisInfoMap['size' ] <=  database.maxFileSize;
729+         ( thisInfoMap['size' ]  as   int )  <=  database.maxFileSize;
732730
733731    Uint8List ?  uint8list;
734732    if  (storeable) {
@@ -770,7 +768,7 @@ class Event extends MatrixEvent {
770768    // Is this file storeable? 
771769    final  thisInfoMap =  getThumbnail ?  thumbnailInfoMap :  infoMap;
772770    var  storeable =  thisInfoMap['size' ] is  int  && 
773-         thisInfoMap['size' ] <=  database.maxFileSize;
771+         ( thisInfoMap['size' ]  as   int )  <=  database.maxFileSize;
774772
775773    Uint8List ?  uint8list;
776774    if  (storeable) {
@@ -802,16 +800,17 @@ class Event extends MatrixEvent {
802800
803801    // Decrypt the file 
804802    if  (isEncrypted) {
805-       final  fileMap = 
806-           getThumbnail ?  infoMap['thumbnail_file' ] :  content['file' ];
807-       if  (! fileMap['key' ]['key_ops' ].contains ('decrypt' )) {
803+       final  fileMap =  getThumbnail
804+           ?  infoMap['thumbnail_file' ] as  Map 
805+           :  content['file' ] as  Map ;
806+       if  (! (fileMap['key' ] as  Map )['key_ops' ].contains ('decrypt' )) {
808807        throw  ("Missing 'decrypt' in 'key_ops'." );
809808      }
810809      final  encryptedFile =  EncryptedFile (
811810        data:  uint8list,
812-         iv:  fileMap['iv' ],
813-         k:  fileMap['key' ]['k' ],
814-         sha256:  fileMap['hashes' ]['sha256' ],
811+         iv:  fileMap['iv' ]  as   String ,
812+         k:  ( fileMap['key' ]  as   Map ) ['k' ]  as   String ,
813+         sha256:  ( fileMap['hashes' ]  as   Map ) ['sha256' ]  as   String ,
815814      );
816815      uint8list = 
817816          await  room.client.nativeImplementations.decryptFile (encryptedFile);
0 commit comments