0 purchases
translatelkt
Getting started #
You can use instant translation simply by calling the library and you can translate into all languages
Example #
import 'package:flutter/material.dart';
import 'package:translatlkt/translatelkt.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
var desc = ''; // Initialize desc
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: double.infinity,
),
Text(desc),
ElevatedButton(
onPressed: () {
translateAndSetState();
},
child: Text("Translate"),
)
],
),
),
);
}
// Function to translate and set the state
void translateAndSetState() async {
var translatedText = await translateLkt('en', 'ar', 'hello, how are you');
setState(() {
desc = translatedText;
});
}
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.