diff --git a/lib/entities/generate_name.dart b/lib/entities/generate_name.dart index b6418dfe6..4aa570769 100644 --- a/lib/entities/generate_name.dart +++ b/lib/entities/generate_name.dart @@ -2,17 +2,23 @@ import 'dart:math'; import 'package:flutter/services.dart'; +extension StringExtension on String { + String capitalized() { + return "${this[0].toUpperCase()}${this.substring(1)}"; + } +} + Future generateName() async { final randomThing = Random(); final adjectiveStringRaw = - await rootBundle.loadString('assets/text/Wallet_Adjectives.txt'); + await rootBundle.loadString('assets/text/Wallet_Adjectives.txt'); final nounStringRaw = - await rootBundle.loadString('assets/text/Wallet_Nouns.txt'); + await rootBundle.loadString('assets/text/Wallet_Nouns.txt'); final adjectives = List.from(adjectiveStringRaw.split('\n')); final nouns = List.from(nounStringRaw.split('\n')); final chosenAdjective = adjectives[randomThing.nextInt(adjectives.length)]; final chosenNoun = nouns[randomThing.nextInt(nouns.length)]; - final returnString = chosenAdjective + ' ' + chosenNoun; - + final returnString = + chosenAdjective.capitalized() + ' ' + chosenNoun.capitalized(); return returnString; -} \ No newline at end of file +}