Skip to content

Commit

Permalink
chore: capitalize method for String
Browse files Browse the repository at this point in the history
New file:
* `string_extension.dart`: extension for `String`

Impacted file:
* `user_preferences_languages_list.dart`: now using the new `String` extension instead of deprecated library
  • Loading branch information
monsieurtanuki committed Oct 26, 2023
1 parent 2d90250 commit fa60450
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/smooth_app/lib/helpers/string_extension.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extension StringExtension on String {
String capitalize() => isEmpty
? this
: this[0].toUpperCase() + (length == 1 ? '' : substring(1));
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_native_splash/cli_commands.dart';
import 'package:openfoodfacts/openfoodfacts.dart';
import 'package:smooth_app/helpers/string_extension.dart';

class Languages {
const Languages();
Expand Down

0 comments on commit fa60450

Please sign in to comment.