Changed some deprecated methods to make it compatible with new versions of Dart