import 'dart:convert'; import 'package:crypto/crypto.dart'; import 'package:flutter/material.dart'; extension CapExtension on String { String get toCamelCase => "${this[0].toUpperCase()}${this.substring(1)}"; String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}'; String get allInCaps => this.toUpperCase(); String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.isNotEmpty ? str.inCaps : str).join(" ") : ""; } extension HashSha on String { String get toSha256 { var bytes = utf8.encode(this); return sha256.convert(bytes).toString(); } } extension OnTapWidget on Widget { Widget onTap(VoidCallback onTap, {Key? key}) { return GestureDetector( key: key, onTap: onTap, child: this, // This refers to the widget on which the extension is called ); } }