updated code for M3, and modified pubspec.yaml