A validator of type Future
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 38/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- dart
调研方向
Read the FormzInput validator contract and the example in lib/models/phone_number.dart. Confirm how the synchronous return type conflicts with libphonenumber's Future, then define the desired async-validation API and its completion criteria with maintainers.
由索引模型根据 Issue 内容生成。
描述
Hello,
I'm trying to use Formz to validate a phonenumber using the https://pub.dev/packages/libphonenumber library.
But libphonenumber's validation function returns a Future, so I was unable to use it in the validator() function of Formz
import 'package:formz/formz.dart';
import 'package:libphonenumber/libphonenumber.dart';
enum PhoneNumberValidationError { invalid }
class PhoneNumber extends FormzInput<String, PhoneNumberValidationError> {
const PhoneNumber.pure() : super.pure('');
const PhoneNumber.dirty([String value = '']) : super.dirty(value);
static final _phoneNumberRegex = RegExp(r'^[+]{1}[0-9]{1,4}[-\s\./0-9]*$');
@override
PhoneNumberValidationError validator(String value) {
return PhoneNumberUtil.isValidPhoneNumber(phoneNumber: "", isoCode: 'US').then((value){
return null;
});
}
}
error: A value of type 'Future<Null>' can't be returned from method 'validator' because it has a return type of 'PhoneNumberValidationError'. (return_of_invalid_type at [datoraid] lib/models/phone_number.dart:16)
- 主要语言
- Dart
- 星标
- 491
- 派生
- 43
- 平均合并
- 19 小时 23 分钟
- 30 天内合并 PR
- 5
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
VeryGoodOpenSource/formz 的其他 Issue
-
feature
难度 4/5 3-5 天 新手友好度 52/100
VeryGoodOpenSource/formz#166 ·
-
feature p3
难度 5/5 一周以上 新手友好度 25/100
VeryGoodOpenSource/formz#121 · 5 条评论 ·
-
Clear a TextField without a TextEditingController.可能重新可做 @eraps7 于 980 天前认领,目前没有进行中的 PR。 未关闭
难度 5/5 一周以上 新手友好度 25/100
VeryGoodOpenSource/formz#111 · 1 条评论 · 1 个 reaction ·
-
documentation p3
难度 4/5 3-5 天 新手友好度 35/100
VeryGoodOpenSource/formz#110 · 1 条评论 · 8 个 reaction ·
-
documentation p3
难度 4/5 3-5 天 新手友好度 25/100
VeryGoodOpenSource/formz#101 · 2 个 reaction ·
查看 VeryGoodOpenSource/formz 的全部 Issue
相似的 Issue
-
p: material_ui package platform-android platform-ios platform-linux platform-macos platform-web team-design
难度 2/5 1-3 小时 新手友好度 62/100
flutter/flutter#195878 · 1 条评论 ·
维护者通常 1 天内回复
-
[genkit_google_genai] Gemini tool call with no arguments fails with "requires a non-null input"可能已有人在做 @kenzieschmoll 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 80/100
genkit-ai/genkit-dart#692 ·
维护者通常 11 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
-
bug
难度 1/5 1 小时以内 新手友好度 85/100
lollipopkit/flutter_server_box#1851 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复