Translation class

Constructors

Translation({required String apiKey, void onError(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.

Properties

apiKey String
Returns the value of the token in google.
no setter
hashCode int
The hash code for this object.
no setterinherited
http ↔ Client
We can inject the client required, useful for testing
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

detectLang({required String text}) Future<TranslationModel>
Detects source lang. text text to detect.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
translate({required String text, required String to}) Future<TranslationModel>
Sends a request to translate. text text to translate. to to what language translate.

Operators

operator ==(Object other) bool
The equality operator.
inherited