错误:如方法'getData'所定义,返回类型'String'不是'void'。 (位于[todo_app_ui] lib / redis.dart:9处的return_of_invalid_type)
此功能用于从Redis服务器获取数据并将其放入Flutter应用中。
import 'package:resp_client/resp_client.dart';
import 'package:resp_client/resp_commands.dart';
void getData(key) async {
final server = await connectSocket('localhost');
final client = RespClient(server);
final commands = RespCommands(client);
final get = await commands.get('test');
return get;
}
错误:如方法'getData'所定义,返回类型'String'不是'void'。 (位于[todo_app_ui] lib / redis.dart:9处的return_of_invalid_type)
答案 0 :(得分:0)
有它如何解决! :
import 'package:resp_client/resp_client.dart';
import 'package:resp_client/resp_commands.dart';
Future<void> getData(key) async {
final server = await connectSocket('localhost');
final client = RespClient(server);
final commands = RespCommands(client);
final get = await commands.get('test');
return get;
}