i recently started learning flutter. I was working on the 'package:english_words/english_words.dart' package. I have successfully imported it by modifying the pubspec.yaml file by adding 'english_words: ^3.1.0 inside dependencies and on the main.dart file child:Text(wordPair.asPascalCase) is throwing an error. The output I got after running it is :
Compiler message: lib/main.dart:17:23: Error: Getter not found: 'wordPair'.
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null build failed.
FAILURE: Build failed with an exception.
Where: Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 780
What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'. Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1
and here is my code:
import 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Welcome to Flutter',
home: Scaffold(
appBar: AppBar(
title: const Text('Welcome to Flutter'),
),
body: const Center(
child: Text(wordPair.asPascalCase),
),
),
);
}
}
my english.dart file is
/// Support for working with English text.
library english_words;
export 'src/syllables.dart';
export 'src/word_pair.dart';
export 'src/words/adjectives.dart';
export 'src/words/all.dart';
export 'src/words/nouns.dart';