Coder Social home page Coder Social logo

fredeil / email-validator.dart Goto Github PK

View Code? Open in Web Editor NEW
188.0 8.0 38.0 135 KB

A simple Dart class for validating email addresses (syntax) without using RegEx :email:

Home Page: https://pub.dartlang.org/packages/email_validator

License: MIT License

Dart 98.72% Shell 1.28%
email email-validation dart mail validation email-validator flutter

email-validator.dart's People

Contributors

eoin-flynn avatar fabianmendez avatar fredeil avatar github-actions[bot] avatar k5924 avatar maxzod avatar mwawrusch avatar nivisi avatar sidrao2006 avatar valentinvignal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

email-validator.dart's Issues

Emoji should not be valid

Hi,

The validate function return TRUE for an address like “user@👕.com” but an emoji email isn't a valid email

Thanks

README Contains Incorrect Version Number

The version number listed in the README is for V1.0.6. Using this version results in the following when trying to run an application:
Error: Cannot run with sound null safety, because the following dependencies

Return reason for invalidity

Hey 👋 Thanks for your library!

I wanted to check if you would consider including a way, to provide the reason the validation fails?
Maybe by returning enum values or something.

I guess many use the library to validate an email input, but then can only add an error message like "Please enter a valid email address", while most users don't really get why the entered address isn't working. Especially if they added an accidental whitespace at the end.

We are currently adding some additional validations for certain cases like whitespaces, but this also means we start to duplicate logic from your library, which doesn't feel right.

Looking forward to hear your thoughts on this.
Cheers

Invalid validation when user input email address in other languages like persian

First of all, thanks for creating such a wonderful package. I'm not sure if it's really an issue or not, and I just want to help this package get better. When testing the package with emails like [email protected] or [email protected], everything is fine. However, when giving the package inputs like:

ایمیل@جیمیل.کام

it returns true. In my case, I don't want to accept such emails in my program. I'm not sure if there is any email address like this or not, but I have never seen one. The above inputs are written in the Persian language, and the package only checks the pattern of an email and doesn't check the language of characters.

Old package version in Readme

Hey 👋

I've noticed that the GitHub and pub.dev readmes still mention the old version (1.0.5). Not a big deal, yet, if you'll have a minute 🙂

Incompatible Type Error

Description
Hi developer team, we were using email_validator package with version 2.0.1, and it was fine with the codebase. However, recently found out that updating version 2.1.2-2.1.16 will break the code with the error messages shown below:

error 1

error 2

Environments
OS: MacOs Monterey v12.3 x64
Language: Dart SDK version: 2.17.6 (stable)
email_validator version: 2.1.2 or later

False returned on email address

Hello, I have an email address of the format xsdffgbh###@gmail.com (letters followed by three numbers) that is being rejected by the package. Can anyone assist me with this?

Warning: Operand of null-aware operation '!' has type 'String' which excludes null.

Before adding null check

When using the TextFormField's validator parameter, passing the value to EmailValidator.validate() warns that I need to Add a null check (!). Screenshot showing the warning with suggested fix.

CleanShot 2021-11-16 at 08 03 39@2x

After adding null check (plus print statement)

However, if I add the null check bang, and try to print the result of EmailValidator.validate(value!), I get a different warning:

Warning: Operand of null-aware operation '!' has type 'String' which excludes null.

CleanShot 2021-11-16 at 08 04 57@2x

Question

Is this warning something that should be fixed in this email-validator package? The Stack Overflow posts I've read for this warning from other packages indicated that a fix was necessary in the package's code. E.g. https://stackoverflow.com/questions/67389956/why-im-getting-this-error-warning-operand-of-null-aware-operation-has-type

Local domain names not supported

Describe the bug 🐛

admin@mailserver1 (local domain name with no TLD, although ICANN highly discourages dotless email addresses)

Null safety support

email_validator: '^1.0.6'1

Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:email_validator

For solutions, see https://dart.dev/go/unsound-null-safety
Unhandled exception:
Bad state: Unsupported Null Safety mode NonNullableByDefaultCompiledMode.Invalid, in null.
#0      ProgramCompiler.emitModule (package:dev_compiler/src/kernel/compiler.dart:472:9)
#1      JavaScriptBundler.compile (package:frontend_server/src/javascript_bundle.dart:152:33)
#2      FrontendCompiler.writeJavascriptBundle (package:frontend_server/frontend_server.dart:665:47)
<asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:573:9)
<asynchronous suspension>
#4      listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1154:11)
<asynchronous suspension>
Finished with error: the Dart compiler exited unexpectedly.
Failed to compile application.

i have found out almost 15 + issues in your project i want to be project contributor

{
"resource": "/C:/Flutter Project/newproject/awesome-flutter/email-validator.dart/test/email_validator_test.dart",
"owner": "dart",
"code": {
"value": "undefined_function",
"target": {
"$mid": 1,
"external": "https://dart.dev/tools/diagnostic-messages#undefined_function",
"path": "/tools/diagnostic-messages",
"scheme": "https",
"authority": "dart.dev",
"fragment": "undefined_function"
}
},
"severity": 8,
"message": "The function 'equals' isn't defined.\nTry importing the library that defines 'equals', correcting the name to the name of an existing function, or defining a function named 'equals'.",
"source": "dart",
"startLineNumber": 135,
"startColumn": 59,
"endLineNumber": 135,
"endColumn": 65,
"tags": []
}

Not working for tests without domain

Describe the bug 🐛
If a pass in 'kkkk@' is returns with confirming to be a valid email which I don't believe.

To Reproduce
Steps to reproduce the behavior:

Expected behavior
If I use https://isemail.info for instance, it says: "The general result is: Address is invalid for any purpose. The specific diagnosis is: Address has no domain part."

Additional context
Add any other context about the problem here.

Email addresses with hyphen not valid

Describe the bug 🐛
Email addresses with a hyphen in the domain are marked as not valid but they are.

To Reproduce
Test the email address: [email protected]

Expected behavior
Should be correct.

Additional context
Validator returns false.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.