Last updated:
0 purchases
flutter work utils
Flutter Work Utils #
Flutter Utils is a miscelaneous package with multiple utilities that can take out of thinking how to solve problems or losing time building simple methods that should already exist in flutter
Flutter Work Utils includes this packages #
color_parse: A method to parse hex color strings to Color objects.
e.g.
String stringColor = "ff000000";
Color? res = colorFromString (stringColor);
copied to clipboard
dates: An extension of DateTime class to have multiple types of string formatted dates
e.g.
DateTime date = DateTime.now ();
print (date.dateString); // Will return 26-09-2022
print (date.hourString); // Will return 22:42
print (date.monthAbbr); // Will return SEPT
copied to clipboard
It also has a method to parse a millsecond date to DateTime? class validating zeros
digester: An extension of String impulsed by crypto package to convert a string into sha256 diggest
e.g.
String password = "hola12";
String diggest = password.diggest; // Will return sha256 of "hola12"
copied to clipboard
font_color_switcher: Includes a method that will return the contrasted color of the background passed as argument
e.g.
Color background = Colors.black;
Color textColor = getColorContrast(background); // Will return white
copied to clipboard
iterable: An Extension of iterable class
methods
containsLambda: A method to get all values of a list that match with a method
e.g.
List<String> names = ["John", "Charles", "Lisa", "Dog"];
List<String> namesWithO = names.containsLambda ((name) => name.contains("o"));
copied to clipboard
allLambda: A method to check if all elements in a current list satisfy a method
e.g.
List<String> names = ["John", "Charles", "Lisa", "Dog"];
print (names.allLambda ((name) => name.contains("o"))); // prints false
copied to clipboard
containsAll: A method to check if all elements of a list exists in current List
e.g.
List<String> names = ["John", "Charles", "Lisa", "Dog"];
print (names.containsAll (["John", "Miguel"])); // prints false
copied to clipboard
containsAny: A method to check if at least one elements of a list exists in current list
e.g.
List<String> names = ["John", "Charles", "Lisa", "Dog"];
print (names.containsAny (["John", "Miguel"])); // prints true
copied to clipboard
logger: A package to log with a better structure
NOTE: Xcode does not support color Text
methods
printWarning (Object)
printError (Object)
printSuccess (Object)
printLog (Object)
map: An extension of Map with utils
methods:
pprint: Return a string of the map with a pretty printing
e.g.
Map<String, dynamic> myMap = {"Hello": "There", "General": "Kenobi"}
print (myMap.pprint); //will print
/*
Hello: There
General: Kenobi
*/
copied to clipboard
nav_route: Contains a method to generate a uri route based on a string route and query parameters
e.g.
String route = generateNavRoute ("/home", queryParams: {"foo": "bar"});
print (route); // prints "/home?foo=bar"
copied to clipboard
network_image: Contains a method to load and get bytes of an image from a URL
e.g.
Uint8List? bytes = getBytesFromNetworkImageUrl ("https://image.com/image.png");
copied to clipboard
query_parameters: An extension of string that will generate a RoutingData object based on a navigation route
e.g.
String route = "/home?foo=bar"; // See nav_route package
RoutingData data = route.getRoutingData;
print (data.contains ("foo")); // prints true
copied to clipboard
router: Contains a class to manage routing with a web strategy (Beta)
attributes
navigatorKey: Key binded to material app, allow this class to control the app navigation in any moment of context
methods:
navigateTo: Used to navigate with named routes and query params
e.g.
//Using get_it package
locator<NavigationService>.navigateTo("/home", queryParams: {"foo": "bar"});
copied to clipboard
goBack: Used to return to the last tree position
e.g.
//Using get_it package
locator<NavigationService>.goBack();
copied to clipboard
This package also contains a method to get query params by name
e.g.
String? fooValue = getQueryParam (context, "foo"); // will save bar
copied to clipboard
scroll_configuration: This package contains a scroll behavior that will be very useful in web development, because it removes default scrolling
This scroll configuration should be applied in the return of the child in material app
e.g.
return MaterialApp(
title: 'Test',
debugShowCheckedModeBanner: runtime == "Test",
scaffoldMessengerKey: _scaffoldKey,
theme: lightTheme,
darkTheme: darkTheme,
themeMode: ui.themeMode,
initialRoute: SplashScreen.routeName,
navigatorKey: locator<NavigationService>().navigatorKey, // <-- Here, router package is used
builder: (ctx, child) {
return ScrollConfiguration(
// ScrollClean is the configuration
behavior: ScrollClean().copyWith(
scrollbars: false
),
child: child??Container()
);
},
localizationsDelegates: const [
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate
],
supportedLocales: S.delegate.supportedLocales,
locale: Locale(ui.locale),
onGenerateRoute: (settings) => RutaPercepthor.generateRoute(settings, context),
);
copied to clipboard
string_utils: An extension of string that contains some useful string formats
attributes:
pertenence: Will return the pertenence string of a word
e.g.
String name = "John";
print ("${name.pertenence} house"); // will print "John's house
copied to clipboard
formattedSearchText: Will return a string with no spaces, in lowercase and with no diacritics
e.g.
Sring name = "MarĂa Juanita Lisandra";
print (name.formattedSearchtext); //. Will print "mariajuanitalisandra";
copied to clipboard
unfocus: Contains a method to unfocus keyboard from screen in any context
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.