This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // Reusable fetching hook | |
| const useRequest = (requestFunc) => { | |
| const [data, setData] = useState({}) | |
| const [loading, setLoading] = useState(false) | |
| const [error, setError] = useState(null) | |
| const fetch = async () => { | |
| setLoading(true) | |
| try { | |
| const data = await requestFunc() | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const floor3 = (n) => { | |
| if (n%3 === 0) { | |
| return n | |
| } | |
| return floor3(n - 1) | |
| } | |
| // Class to help keep track of the proper order of things. | |
| class Sudoku { | |
| constructor (puzzle, annotations) { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | void main() { | |
| Message messageNoTitle = Message(message: "stuff"); | |
| print("No title: ${messageNoTitle.displayText}"); | |
| assert(messageNoTitle.message == messageNoTitle.displayText); | |
| Message messageEmptyTitle = Message(message: "this", title: ""); | |
| print("Empty title: ${messageEmptyTitle.displayText}"); | |
| assert(messageEmptyTitle.message == messageEmptyTitle.displayText); | |
| Message messageWithTitle = | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import React from "react" | |
| import ReactDOM from "react-dom/client" | |
| import App from "./App" | |
| import { TolgeeProvider } from "@tolgee/react"; | |
| import * as localeEn from './assets/i18n/en.json'; | |
| import * as localeEs from './assets/i18n/es.json'; | |
| const root = ReactDOM.createRoot(document.getElementById("root")) | |
| root.render( | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /// SWITCH STATEMENTS | |
| void main() { | |
| String food = "Hamburger"; | |
| switch (food) { | |
| case "Cheeseburger": | |
| case "Hamburger": | |
| case "Burger": | |
| print("This is a burger"); | |
| break; | |
| case "Fries": | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /// RELATIONAL OPERATORS | |
| void main() { | |
| // == | |
| bool fives = 5 == 5; // true | |
| bool mixed = 4 == 5; // false | |
| bool varred = fives == true; // true | |
| bool strings = "This" == "That"; // false | |
| bool sameStrings = "computeringstuff" == "computeringstuff"; // true | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /// LOGICAL OPERATORS | |
| void main() { | |
| // && | |
| bool first = (true) && (true); // true | |
| bool second = (true) && (false); // false | |
| List array = [1, 2, 3]; | |
| Map map = {}; | |
| bool theyAreBothEmpty = array.isEmpty && map.isEmpty; // false | |
| bool theyAreBothNotEmpty = array.isNotEmpty && map.isNotEmpty; // false | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /// FUNCTIONS | |
| void main() { | |
| int sum = add(1, 3); | |
| print("$sum"); // 4 | |
| logger("stuff"); // stuff | |
| int starting = 0; | |
| double ending = toDouble(starting); | |
| print("${ending is double}"); // 0.0 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /// DART TYPES | |
| void main() { | |
| // numbers | |
| int? integer = null; | |
| double? fraction = 1.0; | |
| // strings | |
| String thisString = "this is a string. 😜"; | |
| // booleans | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import React, { useState, useEffect } from 'react' | |
| import { | |
| Map, | |
| BasemapContainer, | |
| ContextMenu, | |
| Controls, | |
| Popup, | |
| VectorLayer | |
| } from '@bayer/ol-kit' | |
| import { fromLonLat } from 'ol/proj' | 
NewerOlder