0

バックグラウンド

無限スクロールリストに供給される1つの巨大なマップを持つことができるように、別々のリクエストから来る2つのマップ(実際には2つ以上)を結合しようとしています

私の質問

Map<String,dynamic>この場合、Map1 と Map2 の2 つの別個のデータを 1 つのエンティティに結合することはできますか? キャッチは、ネストされた要素からのデータのみが他の要素にマージされることです。この場合、appDataフィールドから

マップ1

{
   userData: 
         {loggedin: 0, username: Mike}, 
   appData: 
       [
         {id: 1, title: Title1, excerpt: , thumb: thumb1.jpg, threadid: 1, fid: 1, commentcount: 1, postdate: 1}, 
         {id: 2, title: 2, excerpt: , thumb: 2.jpg, threadid: 2, fid: 2, commentcount: 2, postdate: 2}, 
         {id: 3, title: 3, excerpt: , thumb: 3.jpg, threadid: 3, fid: 3, commentcount: 3, postdate: 3}
       ]
}

マップ2

{
   userData: 
         {loggedin: 0, username: Mike}, 
   appData: 
       [
         {id: 4, title: Title4, excerpt: , thumb: thumb4.jpg, threadid: 4, fid: 4, commentcount: 4, postdate: 4}, 
         {id: 5, title: 5, excerpt: , thumb: 5.jpg, threadid: 5, fid: 5, commentcount: 5, postdate: 5}, 
         {id: 6, title: 6, excerpt: , thumb: 6.jpg, threadid: 6, fid: 6, commentcount: 6, postdate: 6}
       ]
}

結合マップ

{
   userData: 
         {loggedin: 0, username: Mike}, 
   appData: 
       [
         {id: 1, title: Title1, excerpt: , thumb: thumb1.jpg, threadid: 1, fid: 1, commentcount: 1, postdate: 1}, 
         {id: 2, title: 2, excerpt: , thumb: 2.jpg, threadid: 2, fid: 2, commentcount: 2, postdate: 2}, 
         {id: 3, title: 3, excerpt: , thumb: 3.jpg, threadid: 3, fid: 3, commentcount: 3, postdate: 3}
         {id: 4, title: Title4, excerpt: , thumb: thumb4.jpg, threadid: 4, fid: 4, commentcount: 4, postdate: 4}, 
         {id: 5, title: 5, excerpt: , thumb: 5.jpg, threadid: 5, fid: 5, commentcount: 5, postdate: 5}, 
         {id: 6, title: 6, excerpt: , thumb: 6.jpg, threadid: 6, fid: 6, commentcount: 6, postdate: 6}
       ]
}
4

1 に答える 1