stringKindForUrl top-level constant

  1. @experimental
StringKind const stringKindForUrl

StringKind for URLs.

We may modify the validation rules in future.

Example

import 'package:kind/kind.dart';
import 'package:kind/strings.dart';

class Organization extend Entity {
  static final EntityKind<Organization> kind = EntityKind<Organization>(
    name: 'Organization',
    define: (c) {
      c.optional<String>(
        id: 1,
        name: 'url',
        kind: stringKindForUrl,
        getter: (t) => t.url,
        setter: (t,v) => t.url = v,
      );
      c.constructor = () => Organization();
    },
  );

  String? url;

  @override
  EntityKind<Organization> getKind() => kind;
}

Implementation

@experimental
const StringKind stringKindForUrl = StringKind(
  name: 'url',
  isSingleLine: true,
  minLengthInUtf8: 5,
  maxLengthInUtf8: 4096,
  regExpProvider: _urlRegExpProvider,
  examples: [
    'https://google.com',
  ],
);