A sample command-line application with an entrypoint in bin/, library code in
lib/, and example unit test in test/.
The import 'package:dev_utils/dev_utils.dart'; header is used to import all
the available utility functions from the dev_utils library. The
void main() {} function is the entry point for the Dart application. The code
inside this function will be executed when the application starts.
This function generates a random paragraph of text.
paragraphCount: The number of paragraphs to generate.minSentencesPerParagraph: The minimum number of sentences per paragraph.maxSentencesPerParagraph: The maximum number of sentences per paragraph.minWordsPerSentence: The minimum number of words per sentence.maxWordsPerSentence: The maximum number of words per sentence.startWithStandart: If true, the text will start with "Lorem ipsum dolor sit amet...".languageType: The language of the generated text.
import 'package:dev_utils/dev_utils.dart';
void main() {
String lorem = loremParagraphGenerator(
paragraphCount: 3,
minSentencesPerParagraph: 3,
maxSentencesPerParagraph: 7,
minWordsPerSentence: 5,
maxWordsPerSentence: 12,
startWithStandart: true,
languageType: LoremLanguageType.latin,
);
print(lorem);
}This function generates a random list of words.
wordCount: The number of words to generate.startWithStandart: If true, the text will start with "Lorem ipsum dolor sit amet...".languageType: The language of the generated text.
import 'package:dev_utils/dev_utils.dart';
void main() {
String lorem = loremWordGenerator(
wordCount: 5,
startWithStandart: false,
languageType: LoremLanguageType.latin,
);
print(lorem);
}This function generates a list of random passwords.
includeLowerCase: If true, the password will include lowercase letters.includeUpperCase: If true, the password will include uppercase letters.includeNumerics: If true, the password will include numbers.includeSymbols: If true, the password will include symbols.length: The length of the password.generateCount: The number of passwords to generate.
import 'package:dev_utils/dev_utils.dart';
void main() {
List<String> passwords = passwordGenerator(
includeLowerCase: true,
includeUpperCase: true,
includeNumerics: true,
includeSymbols: true,
length: 12,
generateCount: 5,
);
print(passwords);
}This function generates a list of random UUIDs.
version: The version of the UUID to generate.uppercase: If true, the UUID will be in uppercase.hyphens: If true, the UUID will include hyphens.generateCount: The number of UUIDs to generate.
import 'package:dev_utils/dev_utils.dart';
void main() {
List<String> uuids = uuidGenerator(
version: VersionVariant.v4,
uppercase: false,
hyphens: true,
generateCount: 5,
);
print(uuids);
}This function generates a QR code.
qrData: The data to be encoded in the QR code.saveAsFile: If true, the QR code will be saved as a file.filename: The name of the file to save the QR code to.
import 'package:dev_utils/dev_utils.dart';
void main() {
qrCodeGenerator(
qrData: "https://github.com/dev-utils-core",
saveAsFile: true,
filename: "qr_code.png",
);
}
/// IF YOU WANT USE FUNCTION IN FLUTTER
import 'package:flutter/material.dart';
import 'dart:typed_data';
class MyQrWidget extends StatelessWidget {
const MyQrWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final Uint8List? qrBytes = qrCodeGenerator(
qrData: "https://flutter.dev",
saveAsFile: false,
);
if (qrBytes != null) {
return Image.memory(
qrBytes,
width: 250,
height: 250,
fit: BoxFit.contain,
);
} else {
return const Center(
child: Text(
"QR Kod oluşturulamadı.",
style: TextStyle(color: Colors.red),
),
);
}
}
}