list - Flutter Dart / 数据列表的大小
问题描述
我正在创建一个单词应用程序来学习英语词汇。它基于我计划保存在一个列表中的一个非常大的 Word Bank。(硬编码)。
这个大列表由 Word Objects 组成:
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。
这是因为我的名单很大吗?这到底会不会有问题?当/如果我发布应用程序时会导致问题吗?
解决方案
multiDexEnabled
当应用程序中引用超过 64,000 个 JVM 方法时需要。它与任何硬编码数据的大小或与 Dart 相关的任何内容都无关。
这应该不是问题,但是如果您想避免它,可以在Android 开发者网站上尝试一些记录在案的内容。
另一方面,由于您的数据是硬编码的,请尽量使用const
。
推荐阅读
- arrays - 将数据从响应转换为数组
- google-cloud-functions - Google Cloud 功能向 GKE 上托管的应用发送调用
- css - 整个网站的网格区域使用
- wordpress - WordPress WooCommerce REST API
- php - 注册表中的 OTP 集成
- swift - 一个 VC 中的两个表视图
- omnet++ - 关于 SUMO 服务器的 IP 地址
- laravel - 如何删除ckeditor包(错误:找不到类'Ckeditor\CkeditorServiceProvider')?
- redis - kong api网关如何使用redis
- dependencies - ClassNotFoundException : org.apache.http.util.Args - 如何使用 MultipartEntityBuilder 上传文件?