You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
589 B
23 lines
589 B
1 year ago
|
/*
|
||
|
* Copyright (c) 2023. Open Mobile Platform LLC.
|
||
|
* License: Proprietary.
|
||
|
*/
|
||
|
import 'package:flutter/widgets.dart';
|
||
|
import 'package:scoped_model/scoped_model.dart';
|
||
|
import 'package:translator/translator.dart';
|
||
|
|
||
|
/// Model for [TranslatorPage]
|
||
|
class TranslatorModel extends Model {
|
||
|
/// Get [ScopedModel]
|
||
|
static TranslatorModel of(BuildContext context) =>
|
||
|
ScopedModel.of<TranslatorModel>(context);
|
||
|
|
||
|
final translator = GoogleTranslator();
|
||
|
|
||
|
Future<Translation> translate(
|
||
|
String value,
|
||
|
) async {
|
||
|
return await translator.translate(value, from: 'en', to: 'ru');
|
||
|
}
|
||
|
}
|