Skip to content
Snippets Groups Projects
Select Git revision
  • ae286ef6976fb183ae46433fb27e3459c3d12b2c
  • master default protected
  • 37-upgrade-framework-and-dependencies
  • 19-improve-app-metadata
  • Release_0.8.0_33 protected
  • Release_0.7.2_32 protected
  • Release_0.7.1_31 protected
  • Release_0.7.0_30 protected
  • Release_0.6.0_29 protected
  • Release_0.5.0_28 protected
  • Release_0.4.0_27 protected
  • Release_0.3.2_26 protected
  • Release_0.3.1_25 protected
  • Release_0.3.0_24 protected
  • Release_0.2.1_23 protected
  • Release_0.2.0_22 protected
  • Release_0.1.2_21 protected
  • Release_0.1.1_20 protected
  • Release_0.1.0_19 protected
  • Release_0.0.18_18 protected
  • Release_0.0.17_17 protected
  • Release_0.0.16_16 protected
  • Release_0.0.15_15 protected
  • Release_0.0.14_14 protected
24 results

Debug.xcconfig

Blame
  • random_pick_word.dart 954 B
    import 'dart:async';
    import 'dart:convert';
    import 'package:flutter/services.dart';
    
    class RandomPickWord {
      RandomPickWord();
    
      List _words;
    
      init(int count) async {
        _words = new List(count);
        await wordFromLocalFile(count);
      }
    
      Future<void> wordFromLocalFile(int count) async {
        // Get global words list
        List wordList = [];
        try {
          String jsonString = await rootBundle.loadString('assets/files/words-fr.json');
          final jsonResponse = await json.decode(jsonString);
          wordList = jsonResponse['words'];
        } catch (e) {
          print("$e");
        }
    
        // Check we have enough words
        if (wordList.length < count) {
          print('Not enough words in list.');
        }
    
        // Remove empty words
        wordList.removeWhere((value) => value == '');
    
        // Randomize words list
        wordList.shuffle();
    
        // Pick first words from shuffled list
        _words = wordList.take(count).toList();
      }
    
      List get words => _words;
    }