const vs final
The main difference between and
is that can be considered as a
compile-time constant, while can be
considered as a run-time constant.


So when you want the constant value, and
you are aware of the value to be assigned,
at the compile-time itself, you can use
!


But let’s say you want a constant value, but
you don’t know its value at compile-time,
then you can use !
const
const
const
final
final
final
const
final
hello@somniosoftware.com
Leave a comment


Save for later

const vs final

  • 1.
    const vs final Themain difference between and is that can be considered as a compile-time constant, while can be considered as a run-time constant. So when you want the constant value, and you are aware of the value to be assigned, at the compile-time itself, you can use ! But let’s say you want a constant value, but you don’t know its value at compile-time, then you can use ! const const const final final final
  • 2.
  • 3.