我有以下功能,并尝试读取输入值email
和password
,但我得到以下错误:
Future<void> _authenticate(
String email, String password, String urlSegment) async {
Console.log(email);
Console.log(password);
final url = Uri.parse('http://10.0.2.2:8000/api/$urlSegment');
try {
final response = await http.post(
url,
body: json.encode(
{
'email': email,
'password': password,
//'returnSecureToken': true,
},
),
);
.
.
.
实例成员'log'不能使用静态访问访问。
有什么问题吗?为什么我不能在某些应用点使用Console.log()
来查看变量的值?
在flutter中,我们在调试中使用print语句进行控制台。
这样的
print(email);
print(password);
对于字符较多的文本,也可以使用debugPrint("email": $email)。