 
  		        Javaru
Kotlin Coroutine Confidence: Book & source code do not match (pg 180)
On page 180 it says:
If you’re a fan of fluffy felines, you’ll be starting here.
pets/v1/src/main/kotlin/com/example/pets/PetService.kt
const val url = "https://api.thecatapi.com/v1/"
Or, if you’re all about those cuddly canine companions, just swap that line
for this one.
pets/v1/src/main/kotlin/com/example/pets/PetService.kt
const val url = "https://api.thedogapi.com/v1/"
However, the source code has two objects:
object Cats {
  const val url = "https://api.thecatapi.com/v1/"
}
object Dogs {
  const val url = "https://api.thedogapi.com/v1/"
}
with the URL that is used being decided by the import in the file:
import com.example.pets.Dogs.url
So you’ll likely want to update the text on pg 180 to indicate you make the change by changing the import.
p.s. Cats are OK, but Dogs Rule! 
book-kotlin-coroutine-confidence version B3
Marked As Solved
 
		        sam-cooper
Thanks, that’s useful feedback. As you probably guessed, using the two object declarations was a convenient way to include both URLs in the same source file without having a name clash. But I agree that it’s a little confusing, since it means the code in the downloaded source file doesn’t exactly match what I’m describing in the book. I’ll see what I can do to improve that. Adding a note in the text, as you suggested, sounds like a simple solution.
Popular Pragmatic Bookshelf topics
                         
                      
                       
           
           
           
           
           
           
           
          Modern front-end development for Rails, second edition - Struggling to get the first chapter to work
 
           
          Other popular topics
                         
                      
                       
           
           
           
           
           
           
           
           
           
          Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /ruby
- /wasm
- /erlang
- /phoenix
- /keyboards
- /python
- /rails
- /js
- /security
- /go
- /swift
- /vim
- /clojure
- /haskell
- /emacs
- /java
- /svelte
- /onivim
- /typescript
- /kotlin
- /c-plus-plus
- /crystal
- /tailwind
- /react
- /gleam
- /ocaml
- /elm
- /flutter
- /vscode
- /ash
- /html
- /opensuse
- /centos
- /php
- /zig
- /deepseek
- /scala
- /lisp
- /textmate
- /sublime-text
- /react-native
- /nixos
- /debian
- /agda
- /kubuntu
- /arch-linux
- /django
- /revery
- /deno
- /ubuntu
- /spring
- /nodejs
- /manjaro
- /diversity
- /lua
- /julia
- /slackware
- /c
 
    





