<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ankush Bhateja on Medium]]></title>
        <description><![CDATA[Stories by Ankush Bhateja on Medium]]></description>
        <link>https://medium.com/@ankusharora11122001?source=rss-3f05679f8a8e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*VAUz4UvAmL7SOP1p</url>
            <title>Stories by Ankush Bhateja on Medium</title>
            <link>https://medium.com/@ankusharora11122001?source=rss-3f05679f8a8e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 20:34:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ankusharora11122001/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Simplifying Flutter Form Validation with onemanteam_validator]]></title>
            <link>https://medium.com/@ankusharora11122001/simplifying-flutter-form-validation-with-onemanteam-validator-8488f4a265a8?source=rss-3f05679f8a8e------2</link>
            <guid isPermaLink="false">https://medium.com/p/8488f4a265a8</guid>
            <category><![CDATA[flutter-form-validation]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <dc:creator><![CDATA[Ankush Bhateja]]></dc:creator>
            <pubDate>Sun, 08 Mar 2026 09:46:01 GMT</pubDate>
            <atom:updated>2026-03-08T09:46:01.956Z</atom:updated>
            <content:encoded><![CDATA[<h3>I Got Tired of Copy-Pasting the Same Flutter Validator. So I Built a Package.</h3><p><em>How a repetitive frustration led to my first open-source Flutter package — and what I learned along the way.</em></p><p>It started with the fourth form.</p><p>I was building a Flutter app with a login screen, a registration screen, a profile edit screen, and a checkout screen. Each one had text fields. Each one needed validation. And each time, I found myself writing the same block of code:</p><p>dart</p><pre>validator: (value) {<br>  if (value == null || value.isEmpty) {<br>    return &quot;Email is required&quot;;<br>  }<br>  if (!RegExp(r&#39;^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$&#39;).hasMatch(value)) {<br>    return &quot;Enter a valid email&quot;;<br>  }<br>  return null;<br>}</pre><p>Copy. Paste. Adjust the error message. Repeat.</p><p>By the fourth screen, I’d had enough. There had to be a better way — and if there wasn’t, I’d build one.</p><h3>The Problem with Repeating Validation Logic</h3><p>Form validation in Flutter is manual by design. The TextFormField widget gives you a validator callback and leaves the rest up to you. That flexibility is great, but it has a cost: <strong>every project, every screen, every field ends up with custom validation logic written from scratch.</strong></p><p>Over time, this creates real problems:</p><ul><li><strong>Inconsistency</strong> — the email regex on screen A might differ slightly from screen B</li><li><strong>Maintenance overhead</strong> — fixing a validation bug means hunting it down in multiple places</li><li><strong>Wasted time</strong> — developers spend energy on boilerplate instead of actual product logic</li></ul><p>This is exactly the kind of problem a small, focused utility package is built to solve.</p><h3>Introducing onemanteam_validator</h3><p>I built <strong>onemanteam_validator</strong> — a lightweight Flutter package that gives you clean, reusable validators you can drop directly into any TextFormField.</p><p>The idea is simple: <strong>write the validation logic once, use it everywhere.</strong></p><p>Instead of this:</p><p>dart</p><pre>validator: (value) {<br>  if (value == null || value.isEmpty) {<br>    return &quot;Email is required&quot;;<br>  }<br>  if (!RegExp(r&#39;^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$&#39;).hasMatch(value)) {<br>    return &quot;Enter a valid email&quot;;<br>  }<br>  return null;<br>}</pre><p>You write this:</p><p>dart</p><pre>validator: OneManTeamValidator.email()</pre><p>That’s it. One line. The regex pattern, the null check, the error message — all handled internally with sensible defaults you can override.</p><h3>What It Looks Like in Practice</h3><p>Here’s a complete login form using the package:</p><p>dart</p><pre>Form(<br>  key: _formKey,<br>  child: Column(<br>    children: [<br>      TextFormField(<br>        decoration: InputDecoration(labelText: &#39;Email&#39;),<br>        validator: OneManTeamValidator.email(),<br>      ),<br>      TextFormField(<br>        obscureText: true,<br>        decoration: InputDecoration(labelText: &#39;Password&#39;),<br>        validator: OneManTeamValidator.password(minLength: 8),<br>      ),<br>      ElevatedButton(<br>        onPressed: () {<br>          if (_formKey.currentState!.validate()) {<br>            // Proceed<br>          }<br>        },<br>        child: Text(&#39;Login&#39;),<br>      ),<br>    ],<br>  ),<br>)</pre><p>Clean, readable, and consistent across every screen in your app.</p><h3>Features</h3><p>The package currently supports:</p><ul><li>✅ <strong>Email validation</strong> — proper regex-based pattern matching, not just an @ check</li><li>✅ <strong>Password validation</strong> — configurable minimum length and complexity rules</li><li>✅ <strong>Required field validation</strong> — catches null and empty values</li><li>✅ <strong>Minimum length validation</strong> — enforce character limits on any field</li><li>✅ <strong>Custom error messages</strong> — override default messages to match your app’s tone</li></ul><p>Every validator accepts optional parameters so you stay in control without sacrificing convenience.</p><h3>Installation</h3><p>Add it to your pubspec.yaml:</p><p>yaml</p><pre>dependencies:<br>  onemanteam_validator: ^1.0.0</pre><p>Then run:</p><p>bash</p><pre>flutter pub get</pre><p>Import it in your Dart file:</p><p>dart</p><pre>import &#39;package:onemanteam_validator/onemanteam_validator.dart&#39;;</pre><p>You’re ready to go.</p><blockquote><strong><em>Find the package on pub.dev:</em></strong><em> </em><a href="https://pub.dev/packages/onemanteam_validator"><em>pub.dev/packages/onemanteam_validator</em></a></blockquote><h3>My First Open-Source Milestone</h3><p>Publishing this package was a first for me — my first open-source contribution, my first pub.dev listing, and my first time putting something I built in front of strangers on the internet.</p><p>It crossed <strong>80 downloads</strong> within the first few weeks. That number might look modest next to established packages, but it meant something real to me: other developers found it, tried it, and kept it in their projects. That kind of validation (no pun intended) is hard to manufacture.</p><p>Open source taught me things that no tutorial could:</p><ul><li><strong>Small tools fill real gaps.</strong> You don’t need to build the next big framework. A focused utility that solves one problem well is genuinely useful.</li><li><strong>Shipping is the hardest part.</strong> Writing code is one thing. Documenting it, publishing it, and standing behind it publicly is another level entirely.</li><li><strong>Feedback accelerates growth.</strong> Seeing how others use (or struggle with) your package teaches you more about API design than any book.</li></ul><h3>What’s Next</h3><p>This is the first step, not the last. I’m actively planning to:</p><ul><li>Add more validator types (phone numbers, URLs, credit cards)</li><li>Improve test coverage</li><li>Support custom regex validators for niche use cases</li><li>Keep the API simple as the feature set grows</li></ul><p>If you’re building Flutter apps and want to clean up your form validation, give <strong>onemanteam_validator</strong> a try. And if you run into something — a bug, a missing validator, or just feedback on the API — I’d genuinely love to hear it.</p><p><em>Thanks for reading. If this was useful, consider giving the package a like on pub.dev — it helps other developers discover it.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8488f4a265a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>