Flutter应用程序对计算功能的后台使用 [英] Flutter app background use of the compute function

查看:71
本文介绍了Flutter应用程序对计算功能的后台使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习Flutter,在我的第一个应用中,我尝试使用http来获取用户列表。当我尝试使用计算​​功能解析json响应数据时,我的代码坏了。 未定义函数'compute'

I'm learning Flutter and in my first app I try to use http to fetch a list of users. When I try to parse json response data using 'compute' function, my code broken. "The function 'compute' ins't defined"

我不知道发生了什么。

推荐答案

您需要导入基础包。将此文件放在文件的开头

You need to import the foundation package. Put this in the beginning of the file

import 'package:flutter/foundation.dart';

这篇关于Flutter应用程序对计算功能的后台使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆