簡體   English   中英

Flutter Dart / 數據列表大小

[英]Flutter Dart / Size of Data List

我正在創建一個單詞應用程序來學習英語詞匯。 它基於我計划保存在一個列表中的一個非常大的 Word Bank。 (硬編碼)。

這個大列表由 Word 對象組成:

List<Word> wordBank = [
  Word(
    id: 0,
    main: 'alligator',
    articleEng: 'an',
    ortho2: '',
    phon: 'ælɪgeɪtər',
    syllabe: 'alliGAtor',
    son: 'eɪ',
    remPhon: '',
    marqueur: '',
    plur: 'alligators',
    nature: 'noun',
    theme: ['banimals', 'banimaux'],
    subTheme: [
      T(e: 'reptiles', f: 'reptiles'),
      T(e: 'wild animals', f: 'animaux sauvages')
    ],
    level: 2,
    mainFr: 'alligator',
    articleFr: 'un',
    french: [],
    syn: [],
    ant: [],
    wDef:
        'a large reptile similar to a crocodile, with a long tail, hard skin and very big jaws, that lives in rivers and lakes in North and South America and China',
    oDef: '',
    wPhrase: 'There are alligators in this river! Beware!',
    wPhraseFr: 'Il y a des alligators dans cette rivière! Faites attention!',
    oPhrase: '',
    remarque: '',
    past: [],
  ),
]

列表中應該有 2000 到 3000 個這些 Word 對象。 我曾嘗試使用這樣的龐大列表,並且該應用程序運行得相當好。

在安裝 FIREBASE(對於應用程序的其他部分)時,我必須授權“multiDexEnabled true”。 我讀它是因為所有類和方法的總和超過了 64k。

這是因為我的名單很大嗎? 這最終會不會有問題? 當/如果我發布應用程序時會導致問題嗎?

當應用程序中引用了超過 64,000 個multiDexEnabled方法時,需要 multiDexEnabled。 它與任何硬編碼數據的大小或與 Dart 相關的任何內容都無關。

這應該不是問題,但如果您想避免它,可以在Android 開發者網站上嘗試一些記錄在案的事情。

另一方面,由於您的數據是硬編碼的,因此請盡量使用const

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM