instance property
Embrace
instance
Entry point for the SDK. Use this to call send logs and other information to Embrace.
ElevatedButton(
onPressed: () {
Embrace.instance.addBreadcrumb('Tapped button');
},
child: const Text('Add breadcrumb'),
),
You can override this value for mocking in unit testing by setting debugEmbraceOverride.
class MockEmbrace extends Mock implements Embrace {}
void main() {
test('mocking embrace instances', () {
final mockEmbrace = MockEmbrace();
debugEmbraceOverride = mockEmbrace;
expect(Embrace.instance, mockEmbrace);
// You can reset [Embrace.instance] by setting [debugEmbraceOverride] to `null`;
debugEmbraceOverride = null
expect(Embrace.instance, isNot(mockEmbrace));
});
}
Implementation
static Embrace get instance => debugEmbraceOverride ?? _instance;