Translation constructor

Translation({
  1. required String apiKey,
  2. void onError(
    1. Object
    )?,
})

Provides an instance of this class. The instance of the class created with this constructor will send the events on the fly. Also, if a request returns an error, this will be logged but the text will be lost. token is the token associated with your project. onError is a callback function that will be executed in case there is an error, otherwise debugPrint will be used. prefsKey key to use in the SharedPreferences. If you leave it empty a default name will be used.

Implementation

Translation({
  required String apiKey,
  void Function(Object)? onError,
})  : _apiKey = apiKey,
      _onError = onError;