We first need to import the dart foundation in order to run the code only in debug mode:
import 'package:flutter/foundation.dart' as Foundation;
The next step is to use kReleaseMode as follows:
if (Foundation.kReleaseMode){ // is Release Mode??
print('release mode');
} else {
print('debug mode');
}