How to define interfaces in Dart?

前端 未结 4 1702
耶瑟儿~
耶瑟儿~ 2021-02-01 12:52

In Java, I might have an interface IsSilly and one or more concrete types that implement it:

public interfa         


        
4条回答
  •  灰色年华
    2021-02-01 13:05

    
    abstract class ORMInterface {
      void fromJson(Map _map);
    }
    
    abstract class ORM implements ORMInterface {
    
      String collection = 'default';
    
      first(Map _map2) {
        print("Col $collection");
      }
    }
    
    class Person extends ORM {
    
      String collection = 'persons';
    
      fromJson(Map _map) {
        print("Here is mandatory");
      }
    }
    
    

提交回复
热议问题