diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 1985397..0000000 --- a/.gitignore +++ /dev/null @@ -1,74 +0,0 @@ -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -.dart_tool/ -.flutter-plugins -.flutter-plugins-dependencies -.packages -.pub-cache/ -.pub/ -build/ - -# Android related -**/android/**/gradle-wrapper.jar -**/android/.gradle -**/android/captures/ -**/android/gradlew -**/android/gradlew.bat -**/android/local.properties -**/android/**/GeneratedPluginRegistrant.java - -# iOS/XCode related -**/ios/**/*.mode1v3 -**/ios/**/*.mode2v3 -**/ios/**/*.moved-aside -**/ios/**/*.pbxuser -**/ios/**/*.perspectivev3 -**/ios/**/*sync/ -**/ios/**/.sconsign.dblite -**/ios/**/.tags* -**/ios/**/.vagrant/ -**/ios/**/DerivedData/ -**/ios/**/Icon? -**/ios/**/Pods/ -**/ios/**/.symlinks/ -**/ios/**/profile -**/ios/**/xcuserdata -**/ios/.generated/ -**/ios/Flutter/App.framework -**/ios/Flutter/Flutter.framework -**/ios/Flutter/Flutter.podspec -**/ios/Flutter/Generated.xcconfig -**/ios/Flutter/app.flx -**/ios/Flutter/app.zip -**/ios/Flutter/flutter_assets/ -**/ios/Flutter/flutter_export_environment.sh -**/ios/ServiceDefinitions.json -**/ios/Runner/GeneratedPluginRegistrant.* - -# Exceptions to above rules. -!**/ios/**/default.mode1v3 -!**/ios/**/default.mode2v3 -!**/ios/**/default.pbxuser -!**/ios/**/default.perspectivev3 diff --git a/.metadata b/.metadata deleted file mode 100644 index 34563d4..0000000 --- a/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: 8962f6dc68ec8e2206ac2fa874da4a453856c7d3 - channel: stable - -project_type: package diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 2c13702..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "transliteration", - "request": "launch", - "type": "dart" - } - ] -} \ No newline at end of file diff --git a/example/.dart_tool/dartpad/web_plugin_registrant.dart b/example/.dart_tool/dartpad/web_plugin_registrant.dart new file mode 100644 index 0000000..fd546bf --- /dev/null +++ b/example/.dart_tool/dartpad/web_plugin_registrant.dart @@ -0,0 +1,8 @@ +// Flutter web plugin registrant file. +// +// Generated file. Do not edit. +// + +// ignore_for_file: type=lint + +void registerPlugins() {} diff --git a/example/.dart_tool/package_config.json b/example/.dart_tool/package_config.json new file mode 100644 index 0000000..d40e11c --- /dev/null +++ b/example/.dart_tool/package_config.json @@ -0,0 +1,191 @@ +{ + "configVersion": 2, + "packages": [ + { + "name": "async", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/async-2.11.0", + "packageUri": "lib/", + "languageVersion": "2.18" + }, + { + "name": "boolean_selector", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1", + "packageUri": "lib/", + "languageVersion": "2.17" + }, + { + "name": "characters", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/characters-1.3.0", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "clock", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/clock-1.1.1", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "collection", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/collection-1.18.0", + "packageUri": "lib/", + "languageVersion": "2.18" + }, + { + "name": "fake_async", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/fake_async-1.3.1", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "flutter", + "rootUri": "file:///Users/jmdinfotech/development/flutter/packages/flutter", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "flutter_test", + "rootUri": "file:///Users/jmdinfotech/development/flutter/packages/flutter_test", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "http", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/http-1.2.2", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "http_parser", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/http_parser-4.0.2", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "leak_tracker", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/leak_tracker-10.0.5", + "packageUri": "lib/", + "languageVersion": "3.2" + }, + { + "name": "leak_tracker_flutter_testing", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/leak_tracker_flutter_testing-3.0.5", + "packageUri": "lib/", + "languageVersion": "3.2" + }, + { + "name": "leak_tracker_testing", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/leak_tracker_testing-3.0.1", + "packageUri": "lib/", + "languageVersion": "3.2" + }, + { + "name": "matcher", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/matcher-0.12.16+1", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "material_color_utilities", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/material_color_utilities-0.11.1", + "packageUri": "lib/", + "languageVersion": "2.17" + }, + { + "name": "meta", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/meta-1.15.0", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "path", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/path-1.9.0", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "sky_engine", + "rootUri": "file:///Users/jmdinfotech/development/flutter/bin/cache/pkg/sky_engine", + "packageUri": "lib/", + "languageVersion": "3.2" + }, + { + "name": "source_span", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/source_span-1.10.0", + "packageUri": "lib/", + "languageVersion": "2.18" + }, + { + "name": "stack_trace", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/stack_trace-1.11.1", + "packageUri": "lib/", + "languageVersion": "2.18" + }, + { + "name": "stream_channel", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/stream_channel-2.1.2", + "packageUri": "lib/", + "languageVersion": "2.19" + }, + { + "name": "string_scanner", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/string_scanner-1.2.0", + "packageUri": "lib/", + "languageVersion": "2.18" + }, + { + "name": "term_glyph", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/term_glyph-1.2.1", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "test_api", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/test_api-0.7.2", + "packageUri": "lib/", + "languageVersion": "3.2" + }, + { + "name": "transliteration", + "rootUri": "../../", + "packageUri": "lib/", + "languageVersion": "3.5" + }, + { + "name": "typed_data", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/typed_data-1.3.2", + "packageUri": "lib/", + "languageVersion": "2.17" + }, + { + "name": "vector_math", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/vector_math-2.1.4", + "packageUri": "lib/", + "languageVersion": "2.14" + }, + { + "name": "vm_service", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/vm_service-14.2.5", + "packageUri": "lib/", + "languageVersion": "3.3" + }, + { + "name": "web", + "rootUri": "file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/web-1.0.0", + "packageUri": "lib/", + "languageVersion": "3.4" + }, + { + "name": "example", + "rootUri": "../", + "packageUri": "lib/", + "languageVersion": "3.5" + } + ], + "generated": "2024-09-24T08:57:48.272721Z", + "generator": "pub", + "generatorVersion": "3.5.3", + "flutterRoot": "file:///Users/jmdinfotech/development/flutter", + "flutterVersion": "3.24.3", + "pubCache": "file:///Users/jmdinfotech/.pub-cache" +} diff --git a/example/.dart_tool/package_config_subset b/example/.dart_tool/package_config_subset new file mode 100644 index 0000000..d0056ad --- /dev/null +++ b/example/.dart_tool/package_config_subset @@ -0,0 +1,121 @@ +async +2.18 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/async-2.11.0/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/async-2.11.0/lib/ +boolean_selector +2.17 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/lib/ +characters +2.12 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/characters-1.3.0/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/characters-1.3.0/lib/ +clock +2.12 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/clock-1.1.1/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/clock-1.1.1/lib/ +collection +2.18 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/collection-1.18.0/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/collection-1.18.0/lib/ +fake_async +2.12 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/fake_async-1.3.1/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/fake_async-1.3.1/lib/ +http +3.3 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/http-1.2.2/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/http-1.2.2/lib/ +http_parser +2.12 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/http_parser-4.0.2/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/http_parser-4.0.2/lib/ +leak_tracker +3.2 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/leak_tracker-10.0.5/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/leak_tracker-10.0.5/lib/ +leak_tracker_flutter_testing +3.2 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/leak_tracker_flutter_testing-3.0.5/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/leak_tracker_flutter_testing-3.0.5/lib/ +leak_tracker_testing +3.2 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/leak_tracker_testing-3.0.1/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/leak_tracker_testing-3.0.1/lib/ +matcher +3.0 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/matcher-0.12.16+1/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/matcher-0.12.16+1/lib/ +material_color_utilities +2.17 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/material_color_utilities-0.11.1/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/material_color_utilities-0.11.1/lib/ +meta +2.12 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/meta-1.15.0/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/meta-1.15.0/lib/ +path +3.0 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/path-1.9.0/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/path-1.9.0/lib/ +source_span +2.18 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/source_span-1.10.0/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/source_span-1.10.0/lib/ +stack_trace +2.18 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/stack_trace-1.11.1/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/stack_trace-1.11.1/lib/ +stream_channel +2.19 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/stream_channel-2.1.2/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/stream_channel-2.1.2/lib/ +string_scanner +2.18 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/string_scanner-1.2.0/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/string_scanner-1.2.0/lib/ +term_glyph +2.12 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/term_glyph-1.2.1/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/term_glyph-1.2.1/lib/ +test_api +3.2 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/test_api-0.7.2/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/test_api-0.7.2/lib/ +typed_data +2.17 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/typed_data-1.3.2/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/typed_data-1.3.2/lib/ +vector_math +2.14 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/vector_math-2.1.4/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib/ +vm_service +3.3 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/vm_service-14.2.5/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/vm_service-14.2.5/lib/ +web +3.4 +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/web-1.0.0/ +file:///Users/jmdinfotech/.pub-cache/hosted/pub.dev/web-1.0.0/lib/ +transliteration +3.5 +file:///Users/jmdinfotech/Documents/flutter_project/temp/ +file:///Users/jmdinfotech/Documents/flutter_project/temp/lib/ +example +3.5 +file:///Users/jmdinfotech/Documents/flutter_project/temp/example/ +file:///Users/jmdinfotech/Documents/flutter_project/temp/example/lib/ +sky_engine +3.2 +file:///Users/jmdinfotech/development/flutter/bin/cache/pkg/sky_engine/ +file:///Users/jmdinfotech/development/flutter/bin/cache/pkg/sky_engine/lib/ +flutter +3.3 +file:///Users/jmdinfotech/development/flutter/packages/flutter/ +file:///Users/jmdinfotech/development/flutter/packages/flutter/lib/ +flutter_test +3.3 +file:///Users/jmdinfotech/development/flutter/packages/flutter_test/ +file:///Users/jmdinfotech/development/flutter/packages/flutter_test/lib/ +2 diff --git a/example/.gitignore b/example/.gitignore deleted file mode 100644 index 0fa6b67..0000000 --- a/example/.gitignore +++ /dev/null @@ -1,46 +0,0 @@ -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -**/ios/Flutter/.last_build_id -.dart_tool/ -.flutter-plugins -.flutter-plugins-dependencies -.packages -.pub-cache/ -.pub/ -/build/ - -# Web related -lib/generated_plugin_registrant.dart - -# Symbolication related -app.*.symbols - -# Obfuscation related -app.*.map.json - -# Android Studio will place build artifacts here -/android/app/debug -/android/app/profile -/android/app/release diff --git a/example/lib/main.dart b/example/lib/main.dart index dd77a83..5b4c38b 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -21,9 +21,9 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - MyHomePage({Key key, this.title}) : super(key: key); + MyHomePage({Key? key, this.title}) : super(key: key); - final String title; + final String? title; @override _MyHomePageState createState() => _MyHomePageState(); @@ -33,9 +33,9 @@ class _MyHomePageState extends State { String hindiTransliterations = ''; setHindiTransliteration() async { - TransliterationResponse _response = + TransliterationResponse? _response = await Transliteration.transliterate("Hello", Languages.HINDI); - hindiTransliterations = _response.transliterationSuggestions.toString(); + hindiTransliterations = _response!.transliterationSuggestions.toString(); setState(() {}); } @@ -46,7 +46,7 @@ class _MyHomePageState extends State { appBar: AppBar( // Here we take the value from the MyHomePage object that was created by // the App.build method, and use it to set our appbar title. - title: Text(widget.title), + title: Text(widget.title!), ), body: Center( child: Column( @@ -57,7 +57,7 @@ class _MyHomePageState extends State { ), Text( hindiTransliterations, - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineSmall, ), ], ), diff --git a/example/pubspec.lock b/example/pubspec.lock index a13f9a6..84ea6df 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,51 +5,50 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.5.0" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" + version: "1.3.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.18.0" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -64,44 +63,74 @@ packages: dependency: transitive description: name: http - url: "https://pub.dartlang.org" + sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + url: "https://pub.dev" source: hosted - version: "0.13.1" + version: "1.2.2" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dartlang.org" + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "10.0.5" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" source: hosted - version: "0.12.10" + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.15.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" source: hosted - version: "1.8.0" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.11.0" + version: "1.9.0" sky_engine: dependency: transitive description: flutter @@ -111,64 +140,89 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + url: "https://pub.dev" source: hosted - version: "0.2.19" + version: "0.7.2" transliteration: dependency: "direct main" description: path: ".." relative: true source: path - version: "0.0.3" + version: "0.0.4" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.3.2" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + url: "https://pub.dev" + source: hosted + version: "14.2.5" + web: + dependency: transitive + description: + name: web + sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "1.0.0" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=3.5.3 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index bdc78f4..f7b45b4 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,24 +1,11 @@ name: example description: A new Flutter project. - -# The following line prevents the package from being accidentally published to -# pub.dev using `pub publish`. This is preferred for private packages. publish_to: "none" # Remove this line if you wish to publish to pub.dev -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html version: 1.0.0+1 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: ^3.5.3 dependencies: flutter: @@ -30,38 +17,5 @@ dev_dependencies: flutter_test: sdk: flutter -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec -# The following section is specific to Flutter. flutter: - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. uses-material-design: true - # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages diff --git a/pubspec.lock b/pubspec.lock index a106423..2dae1e7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,51 +5,50 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.5.0" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" + version: "1.3.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.18.0" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -64,44 +63,74 @@ packages: dependency: "direct main" description: name: http - url: "https://pub.dartlang.org" + sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + url: "https://pub.dev" source: hosted - version: "0.13.3" + version: "1.2.2" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dartlang.org" + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "10.0.5" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" source: hosted - version: "0.12.10" + version: "0.11.1" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.15.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.9.0" sky_engine: dependency: transitive description: flutter @@ -111,57 +140,82 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + url: "https://pub.dev" source: hosted - version: "0.2.19" + version: "0.7.2" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.3.2" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + url: "https://pub.dev" + source: hosted + version: "14.2.5" + web: + dependency: transitive + description: + name: web + sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "1.0.0" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=3.5.3 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/pubspec.yaml b/pubspec.yaml index 04f61b9..d3edc2f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,47 +5,15 @@ version: 0.0.4 homepage: https://github.com/jaydangar/transliteration environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ^3.5.3 dependencies: flutter: sdk: flutter - http: ^0.13.1 + http: ^1.2.2 dev_dependencies: flutter_test: sdk: flutter -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec -# The following section is specific to Flutter. flutter: null -# To add assets to your package, add an assets section, like this: -# assets: -# - images/a_dot_burr.jpeg -# - images/a_dot_ham.jpeg -# -# For details regarding assets in packages, see -# https://flutter.dev/assets-and-images/#from-packages -# -# An image asset can refer to one or more resolution-specific "variants", see -# https://flutter.dev/assets-and-images/#resolution-aware. -# To add custom fonts to your package, add a fonts section here, -# in this "flutter" section. Each entry in this list should have a -# "family" key with the font family name, and a "fonts" key with a -# list giving the asset and other descriptors for the font. For -# example: -# fonts: -# - family: Schyler -# fonts: -# - asset: fonts/Schyler-Regular.ttf -# - asset: fonts/Schyler-Italic.ttf -# style: italic -# - family: Trajan Pro -# fonts: -# - asset: fonts/TrajanPro.ttf -# - asset: fonts/TrajanPro_Bold.ttf -# weight: 700 -# -# For details regarding fonts in packages, see -# https://flutter.dev/custom-fonts/#from-packages diff --git a/response/transliteration_response.dart b/response/transliteration_response.dart new file mode 100644 index 0000000..2e00b8a --- /dev/null +++ b/response/transliteration_response.dart @@ -0,0 +1,37 @@ +import 'dart:convert'; + +/// converts json to PODO class +List transliterationResponseFromJson(String str) { + final jsonData = json.decode(str); + return new List.from( + jsonData.map((x) => TransliterationResponse.fromJson(x))); +} + +/// converts back from PODO to json String +String transliterationResponseToJson(List data) { + final dyn = new List.from(data.map((x) => x.toJson())); + return json.encode(dyn); +} + +/// PODO class +class TransliterationResponse { + String sourceString; + List transliterationSuggestions; + + TransliterationResponse({ + this.sourceString = '', + this.transliterationSuggestions = const [], + }); + + factory TransliterationResponse.fromJson(Map json) => + new TransliterationResponse( + sourceString: json["ew"], + transliterationSuggestions: + new List.from(json["hws"].map((x) => x)), + ); + + Map toJson() => { + "ew": sourceString, + "hws": new List.from(transliterationSuggestions.map((x) => x)), + }; +} diff --git a/src/languages.dart b/src/languages.dart new file mode 100644 index 0000000..f09c15c --- /dev/null +++ b/src/languages.dart @@ -0,0 +1,26 @@ +/// Supported languages +enum Languages { + ENGLISH, + AMHARIC, + ARABIC, + BENGALI, + CHINESE, + GREEK, + GUJARATI, + HINDI, + KANNADA, + MALAYALAM, + MARATHI, + NEPALI, + ORIYA, + PERSIAN, + PUNJABI, + RUSSIAN, + SANSKRIT, + SINHALESE, + SERBIAN, + TAMIL, + TELUGU, + TIGRINYA, + URDU +} diff --git a/src/main.dart b/src/main.dart new file mode 100644 index 0000000..83c8bc1 --- /dev/null +++ b/src/main.dart @@ -0,0 +1,39 @@ +import 'dart:async'; +import 'package:http/http.dart' as http; +import 'package:http/http.dart'; + +import 'package:transliteration/response/transliteration_response.dart'; +import 'package:transliteration/src/utility.dart'; +import 'package:transliteration/transliteration.dart'; + +/// The Fundamental class that provides static method to transliterate given string. +class Transliteration { + /// This function transliterates english text to the given language code. + /// Exception will be thrown if user is not connected to internet or server is not responding. + /// Returns Input String and top 5 suggestions in a list for transliteration. + static Future transliterate( + String inputString, + Languages languageCode, + ) async { + TransliterationResponse _transliterationResponse = + new TransliterationResponse(); + String srcLanCode = Utility.getLanguageCode(Languages.ENGLISH); + String descLanCode = Utility.getLanguageCode(languageCode); + String lowerCaseSrcString = inputString.toLowerCase(); + final transliterationURL = + '${Utility.transliterationBaseURL}?langpair=$srcLanCode|$descLanCode&text=$lowerCaseSrcString'; + try { + Response _response = await http.get(Uri.parse(transliterationURL)); + List _transliterationResponseList = + transliterationResponseFromJson(_response.body.toString()); + _transliterationResponse.transliterationSuggestions = + _transliterationResponseList.first.transliterationSuggestions; + _transliterationResponse.sourceString = + _transliterationResponseList.first.sourceString; + return _transliterationResponse; + } catch (e) { + print('Exception : $e'); + } + return null; + } +} diff --git a/src/utility.dart b/src/utility.dart new file mode 100644 index 0000000..9c24781 --- /dev/null +++ b/src/utility.dart @@ -0,0 +1,60 @@ +import 'languages.dart'; + +/// Utility class used for internal use... +class Utility { + /// Base URL + static final String transliterationBaseURL = + 'https://www.google.com/transliterate/all'; + + /// Converts Enums to Google Language Codes + static String getLanguageCode(Languages languageCode) { + switch (languageCode) { + case Languages.AMHARIC: + return 'am'; + case Languages.ARABIC: + return 'ar'; + case Languages.BENGALI: + return 'bn'; + case Languages.CHINESE: + return 'zh'; + case Languages.GREEK: + return 'el'; + case Languages.GUJARATI: + return 'gu'; + case Languages.HINDI: + return 'hi'; + case Languages.KANNADA: + return 'kn'; + case Languages.MALAYALAM: + return 'ml'; + case Languages.MARATHI: + return 'mr'; + case Languages.NEPALI: + return 'ne'; + case Languages.ORIYA: + return 'or'; + case Languages.PERSIAN: + return 'fa'; + case Languages.PUNJABI: + return 'pa'; + case Languages.RUSSIAN: + return 'ru'; + case Languages.SANSKRIT: + return 'sa'; + case Languages.SINHALESE: + return 'si'; + case Languages.SERBIAN: + return 'sr'; + case Languages.TAMIL: + return 'ta'; + case Languages.TELUGU: + return 'te'; + case Languages.TIGRINYA: + return 'ti'; + case Languages.URDU: + return 'ur'; + default: + return 'en'; + } + } +} diff --git a/transliteration.dart b/transliteration.dart new file mode 100644 index 0000000..c2e1e62 --- /dev/null +++ b/transliteration.dart @@ -0,0 +1,2 @@ +export 'src/main.dart'; +export 'src/languages.dart';