Ionic Native Badge with capacitor

Basically as a test all I tried was:


import { Badge } from '@ionic-native/badge';

export class MyService {

  constructor( private badge: Badge) {
  }

  async myfunction() {
    this.platform.ready().then(() => {
        this.badge.set(5);
    });
  }
}

which caused a white screen to display and the error message I’ve shown above.
This was called on app initialization.

I’m pretty sure I’m doing something wrong but I haven’t yet figured out what.

I reverted back the changes of my project and am going to start again fresh to see whether that would work.

The current plugins that I use I can’t display because I’ve already reverted back the changes.
Apologies, I’m a bit chaotic right now, I think I should try doing this in a fresh capacitor project to see whether I’m getting the same issues.