MockSuperuser constructor

MockSuperuser({
  1. bool isSuperuser = false,
  2. bool isActivated = false,
  3. String whoAmI = "",
})

Create mocked properties of SuperuserInterface to emulate superuser status.

It is forbidden to enable isActivated without isSuperuser.

Implementation

MockSuperuser(
    {this.isSuperuser = false, this.isActivated = false, this.whoAmI = ""})
    : assert(() {
        if (!isSuperuser) {
          return !isActivated;
        }

        return true;
      }(), "Non-superuser cannot be activated.");