translatelkt 0.1.0 copy "translatelkt: ^0.1.0" to clipboard
translatelkt: ^0.1.0 copied to clipboard

Translate api google

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;
    });
  }
}

2
likes
115
points
13
downloads

Publisher

unverified uploader

Weekly Downloads

Translate api google

Documentation

API reference

License

unknown (license)

Dependencies

flutter, http

More

Packages that depend on translatelkt