├── .gitignore ├── CHANGELOG.md ├── README.md ├── analysis_options.yaml ├── bin ├── dart_tutorials │ ├── dart_variables.dart │ ├── enum_keyword.dart │ └── string_buffer.dart └── data_structure_tutorials │ ├── linked_list │ ├── linked_list.dart │ └── starter.dart │ └── stack.dart ├── lib └── dart_variables.dart ├── pubspec.lock ├── pubspec.yaml └── test └── dart_variables_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | # Files and directories created by pub. 2 | .dart_tool/ 3 | .packages 4 | 5 | # Conventional directory for build output. 6 | build/ 7 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | - Initial version. 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | A sample command-line application with an entrypoint in `bin/`, library code 2 | in `lib/`, and example unit test in `test/`. 3 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the static analysis results for your project (errors, 2 | # warnings, and lints). 3 | # 4 | # This enables the 'recommended' set of lints from `package:lints`. 5 | # This set helps identify many issues that may lead to problems when running 6 | # or consuming Dart code, and enforces writing Dart using a single, idiomatic 7 | # style and format. 8 | # 9 | # If you want a smaller set of lints you can change this to specify 10 | # 'package:lints/core.yaml'. These are just the most critical lints 11 | # (the recommended set includes the core lints). 12 | # The core lints are also what is used by pub.dev for scoring packages. 13 | 14 | include: package:lints/recommended.yaml 15 | 16 | # Uncomment the following section to specify additional rules. 17 | 18 | # linter: 19 | # rules: 20 | # - camel_case_types 21 | 22 | # analyzer: 23 | # exclude: 24 | # - path/to/excluded/files/** 25 | 26 | # For more information about the core and recommended set of lints, see 27 | # https://dart.dev/go/core-lints 28 | 29 | # For additional information about configuring this file, see 30 | # https://dart.dev/guides/language/analysis-options 31 | -------------------------------------------------------------------------------- /bin/dart_tutorials/dart_variables.dart: -------------------------------------------------------------------------------- 1 | import 'package:dart_variables/dart_variables.dart' as dart_variables; 2 | 3 | void main(List arguments) { 4 | 5 | 6 | double? val = double.tryParse("120.343"); 7 | print(val); 8 | 9 | String query = """ 10 | SELECT name, surname, age 11 | FROM people 12 | WHERE age >= 18 13 | ORDER BY name DESC 14 | """; 15 | print(query); 16 | String name = 'ajay'; 17 | String s = 'I am ' + name + ' and I am ' + (23).toString() + ' y.o.'; 18 | print(s); 19 | var b = 'heeeeeeeeeeeeeeeeeeeee$name${32}'; 20 | print(b); 21 | var a = 'I am going to the' 22 | 'second line'; 23 | print(a); 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /bin/dart_tutorials/enum_keyword.dart: -------------------------------------------------------------------------------- 1 | enum Fruits {apple,orange,banana,mango} 2 | enum Chess { king, queen, rook, bishop, knight, pawn } 3 | 4 | void main(List args) { 5 | Fruits liked = Fruits.mango; 6 | var dislike = Fruits.orange; 7 | print(liked.toString()); 8 | print(dislike); 9 | } -------------------------------------------------------------------------------- /bin/dart_tutorials/string_buffer.dart: -------------------------------------------------------------------------------- 1 | void main(List args) { 2 | StringBuffer sb = StringBuffer(); 3 | 4 | sb.write('OOkafi'); 5 | sb.writeCharCode(46); 6 | sb.writeln("com"); 7 | sb.write("Tags :"); 8 | sb.writeAll({"dart","flutter"},','); 9 | 10 | print("length : ${sb.length}"); 11 | print('isEmpty : ${sb.isEmpty}'); 12 | print('isNotEmpty :${sb.isNotEmpty}'); 13 | print('----------\n${sb.toString()}'); 14 | print('Clear the buffer'); 15 | sb.clear(); 16 | print("length : ${sb.length}"); 17 | print('isEmpty : ${sb.isEmpty}'); 18 | print('isNotEmpty :${sb.isNotEmpty}'); 19 | print('----------\n${sb.toString()}'); 20 | 21 | 22 | 23 | for(var i = 0; i < 90; ++i){ 24 | sb.write("$i "); 25 | } 26 | 27 | var value = sb.toString(); 28 | print(value); 29 | 30 | } -------------------------------------------------------------------------------- /bin/data_structure_tutorials/linked_list/linked_list.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | class Node { 5 | Node({required this.value, this.next}); 6 | T value; 7 | Node? next; // / create a node class with value and next 8 | 9 | @override 10 | String toString() { 11 | if (next == null) return '$value'; 12 | return '$value -> ${next.toString()}'; 13 | } 14 | // override String class if next is null value returne 15 | // return value + next 16 | } 17 | 18 | class LinkedList { 19 | Node? tail; 20 | Node? head; 21 | 22 | 23 | void push(E value){ 24 | head = Node(value: value,next: head); 25 | tail ??= head; 26 | 27 | } 28 | 29 | void append(E value){ 30 | if(isEmpty){ 31 | push(value); 32 | return; 33 | } 34 | tail!.next = Node(value: value); 35 | tail = tail!.next; 36 | } 37 | 38 | bool get isEmpty { 39 | return head == null; 40 | } 41 | 42 | @override 43 | String toString() { 44 | if (isEmpty) { 45 | return 'Empty list'; 46 | } 47 | 48 | return head.toString(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /bin/data_structure_tutorials/linked_list/starter.dart: -------------------------------------------------------------------------------- 1 | import 'linked_list.dart'; 2 | void main(List args) { 3 | final node1= Node(value: 10); 4 | final node2 = Node(value: 20); 5 | final node3 = Node(value: 30); 6 | // LinkedList linkedList = LinkedList(); 7 | node1.next= node2; 8 | node2.next = node3; 9 | print(node1); 10 | // print(linkedList.head.toString()); 11 | 12 | // final list = LinkedList(); 13 | // list.push(150); 14 | // list .push(20); 15 | // list.push(500); 16 | // print(list); 17 | 18 | final list = LinkedList(); 19 | list.append(1); 20 | list.append(2); 21 | list.append(3); 22 | print(list); 23 | 24 | 25 | 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /bin/data_structure_tutorials/stack.dart: -------------------------------------------------------------------------------- 1 | class Stack { 2 | Stack() : storage = []; 3 | 4 | final List storage ; 5 | } -------------------------------------------------------------------------------- /lib/dart_variables.dart: -------------------------------------------------------------------------------- 1 | int calculate() { 2 | return 5 * 7; 3 | } 4 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _fe_analyzer_shared: 5 | dependency: transitive 6 | description: 7 | name: _fe_analyzer_shared 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "40.0.0" 11 | analyzer: 12 | dependency: transitive 13 | description: 14 | name: analyzer 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "4.1.0" 18 | args: 19 | dependency: transitive 20 | description: 21 | name: args 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.3.1" 25 | async: 26 | dependency: transitive 27 | description: 28 | name: async 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.9.0" 32 | boolean_selector: 33 | dependency: transitive 34 | description: 35 | name: boolean_selector 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "2.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.16.0" 46 | convert: 47 | dependency: transitive 48 | description: 49 | name: convert 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "3.0.2" 53 | coverage: 54 | dependency: transitive 55 | description: 56 | name: coverage 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "1.5.0" 60 | crypto: 61 | dependency: transitive 62 | description: 63 | name: crypto 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "3.0.2" 67 | file: 68 | dependency: transitive 69 | description: 70 | name: file 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "6.1.2" 74 | frontend_server_client: 75 | dependency: transitive 76 | description: 77 | name: frontend_server_client 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "2.1.3" 81 | glob: 82 | dependency: transitive 83 | description: 84 | name: glob 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "2.1.0" 88 | http_multi_server: 89 | dependency: transitive 90 | description: 91 | name: http_multi_server 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "3.2.1" 95 | http_parser: 96 | dependency: transitive 97 | description: 98 | name: http_parser 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "4.0.1" 102 | io: 103 | dependency: transitive 104 | description: 105 | name: io 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "1.0.3" 109 | js: 110 | dependency: transitive 111 | description: 112 | name: js 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "0.6.4" 116 | lints: 117 | dependency: "direct dev" 118 | description: 119 | name: lints 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "1.0.1" 123 | logging: 124 | dependency: transitive 125 | description: 126 | name: logging 127 | url: "https://pub.dartlang.org" 128 | source: hosted 129 | version: "1.0.2" 130 | matcher: 131 | dependency: transitive 132 | description: 133 | name: matcher 134 | url: "https://pub.dartlang.org" 135 | source: hosted 136 | version: "0.12.12" 137 | meta: 138 | dependency: transitive 139 | description: 140 | name: meta 141 | url: "https://pub.dartlang.org" 142 | source: hosted 143 | version: "1.8.0" 144 | mime: 145 | dependency: transitive 146 | description: 147 | name: mime 148 | url: "https://pub.dartlang.org" 149 | source: hosted 150 | version: "1.0.2" 151 | node_preamble: 152 | dependency: transitive 153 | description: 154 | name: node_preamble 155 | url: "https://pub.dartlang.org" 156 | source: hosted 157 | version: "2.0.1" 158 | package_config: 159 | dependency: transitive 160 | description: 161 | name: package_config 162 | url: "https://pub.dartlang.org" 163 | source: hosted 164 | version: "2.1.0" 165 | path: 166 | dependency: transitive 167 | description: 168 | name: path 169 | url: "https://pub.dartlang.org" 170 | source: hosted 171 | version: "1.8.2" 172 | pool: 173 | dependency: transitive 174 | description: 175 | name: pool 176 | url: "https://pub.dartlang.org" 177 | source: hosted 178 | version: "1.5.1" 179 | pub_semver: 180 | dependency: transitive 181 | description: 182 | name: pub_semver 183 | url: "https://pub.dartlang.org" 184 | source: hosted 185 | version: "2.1.1" 186 | shelf: 187 | dependency: transitive 188 | description: 189 | name: shelf 190 | url: "https://pub.dartlang.org" 191 | source: hosted 192 | version: "1.3.1" 193 | shelf_packages_handler: 194 | dependency: transitive 195 | description: 196 | name: shelf_packages_handler 197 | url: "https://pub.dartlang.org" 198 | source: hosted 199 | version: "3.0.1" 200 | shelf_static: 201 | dependency: transitive 202 | description: 203 | name: shelf_static 204 | url: "https://pub.dartlang.org" 205 | source: hosted 206 | version: "1.1.1" 207 | shelf_web_socket: 208 | dependency: transitive 209 | description: 210 | name: shelf_web_socket 211 | url: "https://pub.dartlang.org" 212 | source: hosted 213 | version: "1.0.2" 214 | source_map_stack_trace: 215 | dependency: transitive 216 | description: 217 | name: source_map_stack_trace 218 | url: "https://pub.dartlang.org" 219 | source: hosted 220 | version: "2.1.0" 221 | source_maps: 222 | dependency: transitive 223 | description: 224 | name: source_maps 225 | url: "https://pub.dartlang.org" 226 | source: hosted 227 | version: "0.10.10" 228 | source_span: 229 | dependency: transitive 230 | description: 231 | name: source_span 232 | url: "https://pub.dartlang.org" 233 | source: hosted 234 | version: "1.9.0" 235 | stack_trace: 236 | dependency: transitive 237 | description: 238 | name: stack_trace 239 | url: "https://pub.dartlang.org" 240 | source: hosted 241 | version: "1.10.0" 242 | stream_channel: 243 | dependency: transitive 244 | description: 245 | name: stream_channel 246 | url: "https://pub.dartlang.org" 247 | source: hosted 248 | version: "2.1.0" 249 | string_scanner: 250 | dependency: transitive 251 | description: 252 | name: string_scanner 253 | url: "https://pub.dartlang.org" 254 | source: hosted 255 | version: "1.1.1" 256 | term_glyph: 257 | dependency: transitive 258 | description: 259 | name: term_glyph 260 | url: "https://pub.dartlang.org" 261 | source: hosted 262 | version: "1.2.1" 263 | test: 264 | dependency: "direct dev" 265 | description: 266 | name: test 267 | url: "https://pub.dartlang.org" 268 | source: hosted 269 | version: "1.21.3" 270 | test_api: 271 | dependency: transitive 272 | description: 273 | name: test_api 274 | url: "https://pub.dartlang.org" 275 | source: hosted 276 | version: "0.4.11" 277 | test_core: 278 | dependency: transitive 279 | description: 280 | name: test_core 281 | url: "https://pub.dartlang.org" 282 | source: hosted 283 | version: "0.4.15" 284 | typed_data: 285 | dependency: transitive 286 | description: 287 | name: typed_data 288 | url: "https://pub.dartlang.org" 289 | source: hosted 290 | version: "1.3.1" 291 | vm_service: 292 | dependency: transitive 293 | description: 294 | name: vm_service 295 | url: "https://pub.dartlang.org" 296 | source: hosted 297 | version: "9.0.0" 298 | watcher: 299 | dependency: transitive 300 | description: 301 | name: watcher 302 | url: "https://pub.dartlang.org" 303 | source: hosted 304 | version: "1.0.1" 305 | web_socket_channel: 306 | dependency: transitive 307 | description: 308 | name: web_socket_channel 309 | url: "https://pub.dartlang.org" 310 | source: hosted 311 | version: "2.2.0" 312 | webkit_inspection_protocol: 313 | dependency: transitive 314 | description: 315 | name: webkit_inspection_protocol 316 | url: "https://pub.dartlang.org" 317 | source: hosted 318 | version: "1.1.0" 319 | yaml: 320 | dependency: transitive 321 | description: 322 | name: yaml 323 | url: "https://pub.dartlang.org" 324 | source: hosted 325 | version: "3.1.1" 326 | sdks: 327 | dart: ">=2.16.1 <3.0.0" 328 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dart_variables 2 | description: A sample command-line application. 3 | version: 1.0.0 4 | # homepage: https://www.example.com 5 | 6 | environment: 7 | sdk: '>=2.16.1 <3.0.0' 8 | 9 | 10 | # dependencies: 11 | # path: ^1.8.0 12 | 13 | dev_dependencies: 14 | lints: ^1.0.0 15 | test: ^1.16.0 16 | -------------------------------------------------------------------------------- /test/dart_variables_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:dart_variables/dart_variables.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | test('calculate', () { 6 | expect(calculate(), 42); 7 | }); 8 | } 9 | --------------------------------------------------------------------------------