Created
          June 10, 2019 19:20 
        
      - 
      
- 
        Save hjJunior/868fb252d949b9d697d43cbeaf81d601 to your computer and use it in GitHub Desktop. 
    Using IoC
  
        
  
    
      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
    
  
  
    
  | class MyIp { | |
| Injector get _injector => Injector.getInjector(); | |
| Client get _client => _injector.get<Client>(); | |
| Future<String> get ipAddress async { | |
| final apiResult = await _client.get('https://api.ipify.org/?format=json'); | |
| return json.decode(apiResult.body)['ip']; | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment