Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Current »

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 = pricing.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)
  • No labels