Calling Library Functions with Aliases
To improve readability, always assign the library element instances to a variable before using them:
final roundingUtils = libs.MathLuib.RoundingUtils
final someNumber = ...
roundingUtils.round(someNumber, 2)
This practice dramatically improves the readability of your code as it grows in size.
Do this:
final productUtils = libs.ProductLib.ProductUtils
final pricinUtils = libs.PricingLib.PricingUtils
final product = productUtils.getProduct(...)
final cost = productUtils.getCost(...)
final margin = pricingUtils.getMargin(...)
final listPrice = pricingUtils.calculatePrice(product, cost, margin)
Â
Don’t do this:
final productUtils = libs.ProductLib.ProductUtils.getProduct(...)
final costUtils = libs.ProductLib.ProductUtils.getCost(...)
final marginUtils = libs.PricingLib.PricingUtils.getMargin(...)
final listPrice = libs.PricingLib.PricingUtils.calculatePrice(product, cost, margin)
Found an issue in documentation? Write to us.
Â