大佬教程收集整理的这篇文章主要介绍了错误:无法在 JavaScript 中准确表示整数文字 0xFFFFFFFFFFFFFFFF,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用 AES 加密来加密我的数据并将我的数据存储到 Firebase 我的算法中
发送数据加密的代码:
List<String> dataTOEncrypt = [name.text,contact.text,Bus_Type.text,Bus.text,Driver.text];
List<dynamic> encryptedData = Encryption().encryptData(dataTOEncrypt);
var d = await FirebaseFirestore.instance.collection('Bus').get();
var ID = d.docs.length+1;
await FirebaseFirestore.instance.collection('Bus').doc('$ID').set({
'image':imageUri??"",'bus_name':encryptedData[0],'bus_contact':encryptedData[1],'bus_type':encryptedData[2],'bus_number':encryptedData[3],'driver':encryptedData[4]
});
我的加密类代码
import 'package:encrypt/encrypt.dart';
final key = Key.fromLength(64);
final iv = IV.fromLength(32);
final encrypter = Encrypter(AES(key));
class Encryption {
encryptData(List<String> data) {
List<dynamic> encryptedList = [];
for (int i = 0; i < data.length; i++) {
final encrypted = encrypter.encrypt(data[i],iv: iv);
encryptedList.add(encrypted);
}
return encryptedList;
}
}
class Decryption{
decryptData(List<dynamic> data){
List<String> decryptedList =[];
for(int i=0;i<data.length;i++){
final decrypted = encrypter.decrypt(data[i],iv: iv);
decryptedList.add(decrypted);
}
return decryptedList;
}
}
但是这件事给了我以下错误:
Target dart2Js Failed: Exception: /D:/software/Flutter/Flutter/.pub-cache/hosted/pub.dartlang.org/pointycastle-3.1.3/lib/key_derivators/argon2.dart:42:27:
Error: The Integer literal 0xFFFFFFFFFFFFFFFF can't be represented exactly in JavaScript.
static const int M32L = 0xFFFFFFFFFFFFFFFF;
^^^^^^^^^^^^^^^^^^
lib/screens/dashboard/components/Add_Trip.dart:715:37:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'bus_name':encryptedData[0]??"",^
lib/screens/dashboard/components/Add_Trip.dart:716:40:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'bus_contact':encryptedData[1]??"",^
lib/screens/dashboard/components/Add_Trip.dart:717:37:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'bus_type':encryptedData[2]??"",^
lib/screens/dashboard/components/Add_Trip.dart:718:39:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'bus_number':encryptedData[3]??"",^
lib/screens/dashboard/components/Add_Trip.dart:719:35:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'driver':encryptedData[4]??""
^
lib/screens/Bus%20Screen/Add_Bus.dart:462:55:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'bus_name':encryptedData[0]??"",^
lib/screens/Bus%20Screen/Add_Bus.dart:463:58:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'bus_contact':encryptedData[1]??"",^
lib/screens/Bus%20Screen/Add_Bus.dart:464:55:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'bus_type':encryptedData[2]??"",^
lib/screens/Bus%20Screen/Add_Bus.dart:465:57:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'bus_number':encryptedData[3]??"",^
lib/screens/Bus%20Screen/Add_Bus.dart:466:53:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'driver':encryptedData[4]??"",^
lib/screens/Drivers/Add_Driver.dart:282:40:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'driver_name':encryptedData[0]??"",^
lib/screens/Drivers/Add_Driver.dart:283:43:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'driver_contact':encryptedData[1]??"",^
lib/screens/Drivers/Add_Driver.dart:284:38:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'driver_ID':encryptedData[2]??"",^
lib/screens/Drivers/Add_Driver.dart:285:43:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'driver_address':encryptedData[3]??"",^
lib/screens/Bus%20Screen/EdiT_Bus.dart:258:49:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'bus_name':encryptedData[0]??"",^
lib/screens/Bus%20Screen/EdiT_Bus.dart:259:52:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'bus_contact':encryptedData[1]??"",^
lib/screens/Bus%20Screen/EdiT_Bus.dart:260:49:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'bus_type':encryptedData[2]??"",^
lib/screens/Bus%20Screen/EdiT_Bus.dart:261:51:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'bus_number':encryptedData[3]??"",^
lib/screens/Bus%20Screen/EdiT_Bus.dart:262:47:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'driver':encryptedData[4]??"",^
lib/screens/Bus%20Screen/EdiT_Bus.dart:451:53:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'bus_name':encryptedData[0]??"",^
lib/screens/Bus%20Screen/EdiT_Bus.dart:452:56:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'bus_contact':encryptedData[1]??"",^
lib/screens/Bus%20Screen/EdiT_Bus.dart:453:53:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'bus_type':encryptedData[2]??"",^
lib/screens/Bus%20Screen/EdiT_Bus.dart:454:55:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'bus_number':encryptedData[3]??"",^
lib/screens/Bus%20Screen/EdiT_Bus.dart:455:51:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'driver':encryptedData[4]??"",^
lib/screens/Drivers/Edit_Driver.dart:248:40:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'driver_name':encryptedData[0]??"",^
lib/screens/Drivers/Edit_Driver.dart:249:43:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'driver_contact':encryptedData[1]??"",^
lib/screens/Drivers/Edit_Driver.dart:250:38:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'driver_ID':encryptedData[2]??"",^
lib/screens/Drivers/Edit_Driver.dart:251:43:
Warning: Operand of null-aware operation '??' has type 'String' which excludes null.
'driver_address':encryptedData[3]??"",^
/D:/software/Flutter/Flutter/.pub-cache/hosted/pub.dartlang.org/pointycastle-3.1.3/lib/src/utils.dart:313:9:
Error: The Integer literal 0xFFFFFFFFFFFFFFFF can't be represented exactly in JavaScript.
((0xFFFFFFFFFFFFFFFF) ^ ((1 << (64 - count)) - 1));
^^^^^^^^^^^^^^^^^^
/D:/software/Flutter/Flutter/.pub-cache/hosted/pub.dartlang.org/pointycastle-3.1.3/lib/src/platform_check/platform_check.dart:6:35:
Error: Method not found: 'getPlatform'.
static Platform get instance => getPlatform();
^^^^^^^^^^^
Error: Compilation Failed.
我知道 JavaScript 可以将最大值存储到 2^53-1。 我想我可以通过简单地将数据转换为 base64 值或字符串值来将数据存储到 firebase 中,但这会导致解密错误。
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的错误:无法在 JavaScript 中准确表示整数文字 0xFFFFFFFFFFFFFFFF全部内容,希望文章能够帮你解决错误:无法在 JavaScript 中准确表示整数文字 0xFFFFFFFFFFFFFFFF所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。