Finally with tons of experiments I figure out the issue. In this scenario we don't want to create a Mock instance manually like below.
class MockMyService extends Mock implements MyService {}
Instead we only needs to annotate the needed class for mocking and run the command dart run build_runner build (as below code)
@GenerateMocks([RoleRepositoryImpl,MslDoctorFirebaseApi])
void main() {}
build runner creates a file with a name like xxxxxxxx.mocks.dart which contains a Mock class , which can be used for the testing.
Usually the the mock class starts with MOCK and follows the rest of the name of the class
eg: RoleRepository -> MockRoleRepositry.
import that to the test case , you will not get any errors