diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e6676e..67a1f13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 1.1.0 +* Add sendToClipBoard on String extension + +* Breaking change + - inCapFirst => capFirst + - inCapsAll => capAll + - capitalizeFirstOfEach => capFirstOfEach + ## 1.0.0 * Add expanded and flexible diff --git a/lib/extensions/string_extension.dart b/lib/extensions/string_extension.dart index 9636193..0dc88d7 100644 --- a/lib/extensions/string_extension.dart +++ b/lib/extensions/string_extension.dart @@ -1,18 +1,19 @@ import 'dart:developer' as dev; import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; extension StringExtension on String { ///Capitalize first letter - String get inCapFirst => + String get capFirst => isNotEmpty ? '${this[0].toUpperCase()}${substring(1)}' : ''; ///Capitalize all letters - String get allInCaps => toUpperCase(); + String get capAll => toUpperCase(); ///Capitalize first letter of each word - String get capitalizeFirstOfEach => - split(' ').map((str) => str.inCapFirst).join(' '); + String get capFirstOfEach => + split(' ').map((str) => str.capFirst).join(' '); ///True if is a valid email bool get isEmail => RegExp( @@ -35,4 +36,9 @@ extension StringExtension on String { } return this; } + + /// Copies the string to the clipboard. + Future get sendToClipBoard async { + await Clipboard.setData(ClipboardData(text: this)); + } } diff --git a/pubspec.yaml b/pubspec.yaml index 944f096..8944567 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: power_ups description: Different utilities to power ups your development. -version: 1.0.0 +version: 1.1.0 repository: https://github.com/alejandrogiubel/power_ups homepage: https://github.com/alejandrogiubel/power_ups