DEV Community

Cover image for Class in dart
Coder
Coder

Posted on

Class in dart

void main() {
  print('Om Namah Shivay');

  Roti roti = Roti(heatReguired: 50.0, name: 'wheat', water: 26.23);
  print(roti.process());
}
//class
class ingredient {
  late String name;
  late double water;
  ingredient({required this.name, required this.water});
}

class Roti extends ingredient {
  late double heatReguired;
  Roti({required this.heatReguired, required super.name, required super.water});

  String process() {
    return '$heatReguired is the heat needed for making roti that take $name and $water water';
  }
}

Enter fullscreen mode Exit fullscreen mode

I understood

Top comments (0)

Sentry growth stunted Image

If you are wasting time trying to track down the cause of a crash, it’s time for a better solution. Get your crash rates to zero (or close to zero as possible) with less time and effort.

Try Sentry for more visibility into crashes, better workflow tools, and customizable alerts and reporting.

Switch Tools